Class Utilities
A utility class which contains helper methods and extension methods.
Inheritance
System.Object
Utilities
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Google.Apis.Core.dll
Syntax
public static class Utilities
Methods
ConvertToString(Object)
Tries to convert the specified object to a string. Uses custom type converters if available.
Returns null for a null object.
Declaration
public static string ConvertToString(object o)
Parameters
Type |
Name |
Description |
System.Object |
o |
|
Returns
Type |
Description |
System.String |
|
GetCustomAttribute<T>(MemberInfo)
A Google.Apis utility method for returning the first matching custom attribute (or null
) of the specified member.
Declaration
public static T GetCustomAttribute<T>(this MemberInfo info)
where T : Attribute
Parameters
Type |
Name |
Description |
System.Reflection.MemberInfo |
info |
|
Returns
Type Parameters
GetDateTimeFromString(String)
Parses the input string and returns System.DateTime if the input is a valid
representation of a date. Otherwise it returns null
.
Declaration
public static DateTime? GetDateTimeFromString(string raw)
Parameters
Type |
Name |
Description |
System.String |
raw |
|
Returns
Type |
Description |
System.Nullable<System.DateTime> |
|
GetEnumStringValue(Enum)
Returns the defined string value of an Enum. Use for test purposes or in other Google.Apis projects.
Declaration
public static string GetEnumStringValue(Enum value)
Parameters
Type |
Name |
Description |
System.Enum |
value |
|
Returns
Type |
Description |
System.String |
|
GetLibraryVersion()
Returns the version of the core library.
Declaration
public static string GetLibraryVersion()
Returns
Type |
Description |
System.String |
|
GetStringFromDateTime(Nullable<DateTime>)
Returns a string (by RFC3339) form the input System.DateTime instance.
Declaration
public static string GetStringFromDateTime(DateTime? date)
Parameters
Type |
Name |
Description |
System.Nullable<System.DateTime> |
date |
|
Returns
Type |
Description |
System.String |
|
ThrowIfNull<T>(T, String)
A Google.Apis utility method for throwing an System.ArgumentNullException if the object is
null
.
Declaration
public static T ThrowIfNull<T>(this T obj, string paramName)
Parameters
Type |
Name |
Description |
T |
obj |
|
System.String |
paramName |
|
Returns
Type Parameters
ThrowIfNullOrEmpty(String, String)
A Google.Apis utility method for throwing an System.ArgumentNullException if the string is
null
or empty.
Declaration
public static string ThrowIfNullOrEmpty(this string str, string paramName)
Parameters
Type |
Name |
Description |
System.String |
str |
|
System.String |
paramName |
|
Returns
Type |
Description |
System.String |
The original string.
|