Class ReflectionExtensions
Class which contains properties, methods which helps to reflect the internal methods or fields and also to acquire their values.
Inheritance
Namespace: Syncfusion.DataSource.Extensions
Assembly: Syncfusion.DataSource.Portable.dll
Syntax
public static class ReflectionExtensions : Object
Methods
BaseType(Type)
Reflection method to get the base type.
Declaration
public static Type BaseType(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the base type. |
Returns
Type | Description |
---|---|
System.Type | Returns the base type. |
GetCulture(CultureInfo)
Reflection method to obtain the current culture.
Declaration
public static string GetCulture(this CultureInfo info)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | info | Represents the culture info. |
Returns
Type | Description |
---|---|
System.String | Returns the string value of determining the culture info. |
GetGenericArguments(Type)
Helper method to get generic arguments from the specified type.
Declaration
public static Type[] GetGenericArguments(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Type[] | Returns the generic type arguments. |
GetIsDynamicBound(IEnumerable)
Helper method to determine whether the obtained enumerable collection is bounded dynamically.
Declaration
public static bool GetIsDynamicBound(this IEnumerable collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | collection | Represents the enumerable collection |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value accordingly. |
GetMember(Type, String)
Helper method to get the members from the specified base type.
Declaration
public static IEnumerable<MemberInfo> GetMember(this Type type, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
System.String | name | Represents the name of the member function which is to be determined. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo> | Returns the enumerable collection of member functions from the specified type. |
GetMethod(Type, String, Type[])
Helper method to get a particular method from the specified type.
Declaration
public static MethodInfo GetMethod(this Type type, string name, Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
System.String | name | Represents the name of the method which is to be determined. |
System.Type[] | types | Represents the types from which the method is to be obtained. |
Returns
Type | Description |
---|---|
System.Reflection.MethodInfo | Returns the obtained method info. |
GetMethods(Type)
Helper method to get the methods from the specified base type.
Declaration
public static IEnumerable<MethodInfo> GetMethods(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> | Returns the enumerable collection of method names. |
GetProperties(Type)
Reflection helper method to get the properties from the mentioned type.
Declaration
public static IEnumerable<PropertyInfo> GetProperties(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type from which the properties has to be obtained. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> | Returns the properties |
GetProperty(Type, String)
Helper method to get a particular property from the specified type.
Declaration
public static PropertyInfo GetProperty(this Type type, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
System.String | name | Represents the name of the property which is to be determined. |
Returns
Type | Description |
---|---|
System.Reflection.PropertyInfo | Returns the obtained property info. |
IsAbstract(Type)
Reflection method to check whether the obtained type is abstract.
Declaration
public static bool IsAbstract(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |
IsAssignableFrom(Type, Type)
Reflection method to determine whether the source type can be assigned to destination type.
Declaration
public static bool IsAssignableFrom(this Type type, Type typeInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the source type. |
System.Type | typeInfo | Represents the destination type. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value whether the source type can to assigned to destination type. |
IsEnum(Type)
Reflection method to check whether the obtained type is enumerated type.
Declaration
public static bool IsEnum(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |
IsGenericType(Type)
Reflection method to check whether the obtained type is generic type. Can be a generic type definition, an open constructed type, or a closed constructed type.
Declaration
public static bool IsGenericType(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |
IsGenericTypeDefinition(Type)
Reflection method to check whether the obtained type is generic type. A constructed type is created by calling the MakeGenericType method on a Type object that represents a generic type definition and specifying an array of type arguments.
Declaration
public static bool IsGenericTypeDefinition(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |
IsInterface(Type)
Reflection method to check whether the obtained type is an interface.
Declaration
public static bool IsInterface(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |
IsPrimitive(Type)
Reflection method to check whether the obtained type is primitive type.
Declaration
public static bool IsPrimitive(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |
IsValueType(Type)
Reflection method to check whether the obtained type is value type.
Declaration
public static bool IsValueType(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Represents the type which is to be determined. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the boolean value regarding the obtained type. |