public static class UtilitiesA utility class which contains helper methods and extension methods.
Namespace
GoogleApisUtilAssembly
Google.Apis.Core.dll
Methods
CheckArgument<T1, T2>(bool, string, string, T1, T2)
public static void CheckArgument<T1, T2>(bool condition, string paramName, string format, T1 arg0, T2 arg1)Checks that given argument-based condition is met, throwing an ArgumentException otherwise.
| Parameters | |
|---|---|
| Name | Description | 
| condition | boolThe (already evaluated) condition to check. | 
| paramName | stringThe name of the parameter whose value is being tested. | 
| format | stringThe format string to use to create the exception message if the condition is not met. | 
| arg0 | T1The first argument to the format string. | 
| arg1 | T2The second argument to the format string. | 
| Type Parameters | |
|---|---|
| Name | Description | 
| T1 | |
| T2 | |
CheckEnumValue<T>(T, string)
public static T CheckEnumValue<T>(T value, string paramName) where T : structChecks that the given value is in fact defined in the enum used as the type argument of the method.
| Parameters | |
|---|---|
| Name | Description | 
| value | TThe value to check. | 
| paramName | stringThe name of the parameter whose value is being tested. | 
| Returns | |
|---|---|
| Type | Description | 
| T | 
 | 
| Type Parameter | |
|---|---|
| Name | Description | 
| T | The enum type to check the value within. | 
ConvertToString(object)
public static string ConvertToString(object o)Tries to convert the specified object to a string. Uses custom type converters if available. Returns null for a null object.
| Parameter | |
|---|---|
| Name | Description | 
| o | object | 
| Returns | |
|---|---|
| Type | Description | 
| string | |
GetCustomAttribute<T>(MemberInfo)
public static T GetCustomAttribute<T>(this MemberInfo info) where T : AttributeA Google.Apis utility method for returning the first matching custom attribute (or null) of the specified member.
| Parameter | |
|---|---|
| Name | Description | 
| info | System.Reflection.MemberInfo | 
| Returns | |
|---|---|
| Type | Description | 
| T | |
| Type Parameter | |
|---|---|
| Name | Description | 
| T | |
GetDateTimeFromString(string)
public static DateTime? GetDateTimeFromString(string raw)Parses the input string and returns DateTime if the input is a valid 
representation of a date. Otherwise it returns null.
| Parameter | |
|---|---|
| Name | Description | 
| raw | string | 
| Returns | |
|---|---|
| Type | Description | 
| DateTime | |
GetEnumStringValue(Enum)
public static string GetEnumStringValue(Enum value)Returns the defined string value of an Enum. Use for test purposes or in other Google.Apis projects.
| Parameter | |
|---|---|
| Name | Description | 
| value | Enum | 
| Returns | |
|---|---|
| Type | Description | 
| string | |
GetLibraryVersion()
public static string GetLibraryVersion()Returns the version of the core library.
| Returns | |
|---|---|
| Type | Description | 
| string | |
GetStringFromDateTime(DateTime?)
public static string GetStringFromDateTime(DateTime? date)Returns a string (by RFC3339) form the input DateTime instance.
| Parameter | |
|---|---|
| Name | Description | 
| date | DateTime | 
| Returns | |
|---|---|
| Type | Description | 
| string | |
ThrowIfNull<T>(T, string)
public static T ThrowIfNull<T>(this T obj, string paramName)A Google.Apis utility method for throwing an ArgumentNullException if the object is
null.
| Parameters | |
|---|---|
| Name | Description | 
| obj | T | 
| paramName | string | 
| Returns | |
|---|---|
| Type | Description | 
| T | |
| Type Parameter | |
|---|---|
| Name | Description | 
| T | |
ThrowIfNullOrEmpty(string, string)
public static string ThrowIfNullOrEmpty(this string str, string paramName)A Google.Apis utility method for throwing an ArgumentNullException if the string is
null or empty.
| Parameters | |
|---|---|
| Name | Description | 
| str | string | 
| paramName | string | 
| Returns | |
|---|---|
| Type | Description | 
| string | The original string. |