Show / Hide Table of Contents

Class TypeEx

Class containing some extension methods for System.Type.

Inheritance
System.Object
TypeEx
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()
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class TypeEx

Methods

| Improve this Doc View Source

GetAttributeDefinitions<TAttribute>(Type)

Gets the attributes of the proprieties of the given type.

Declaration
public static IEnumerable<AttributeDefinitionProperty<TAttribute>> GetAttributeDefinitions<TAttribute>(this Type t)where TAttribute : Attribute
Parameters
Type Name Description
System.Type t

The type to get the attribute definitions from.

Returns
Type Description
System.Collections.Generic.IEnumerable<T><AttributeDefinitionProperty<T><TAttribute>>

Returns the attribute definitions of the given type.

Type Parameters
Name Description
TAttribute The type of attributes to return.
Exceptions
Type Condition
System.ArgumentNullException

t can not be null.

| Improve this Doc View Source

GetGenericTypeArgument(Type)

Gets the first generic argument of the given type.

Declaration
public static Type GetGenericTypeArgument(this Type type)
Parameters
Type Name Description
System.Type type

The type to get the generic argument from.

Returns
Type Description
System.Type

Returns the first generic argument of the given type, or null if the type does not have any generic arguments.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

| Improve this Doc View Source

GetNameWithNamespace(Type)

Gets the name including namespace and assembly of the given type.

Declaration
public static string GetNameWithNamespace(this Type type)
Parameters
Type Name Description
System.Type type

The type to get the name of.

Returns
Type Description
System.String

Returns the name of the given type.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

| Improve this Doc View Source

GetPublicSettableProperties(Type)

Gets the property info of each public settable property of the given type.

Declaration
public static IEnumerable<PropertyInfo> GetPublicSettableProperties(this Type memberType)
Parameters
Type Name Description
System.Type memberType

The type to get the properties of.

Returns
Type Description
System.Collections.Generic.IEnumerable<T><System.Reflection.PropertyInfo>

Returns the property infos.

Exceptions
Type Condition
System.ArgumentNullException

memberType can not be null.

| Improve this Doc View Source

ImplementsICollectionT(Type)

Checks if the given type implements System.Collections.Generic.ICollection<T>

Declaration
public static bool ImplementsICollectionT(this Type type)
Parameters
Type Name Description
System.Type type

The type to check.

Returns
Type Description
System.Boolean

Returns a value of true if the given type implements System.Collections.Generic.ICollection<T>; otherwise, false.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

| Improve this Doc View Source

IsICollectionT(Type)

Checks if the given type implements System.Collections.Generic.ICollection<T>

Declaration
public static bool IsICollectionT(this Type type)
Parameters
Type Name Description
System.Type type

The type to check.

Returns
Type Description
System.Boolean

Returns a value of true if the given type implements System.Collections.Generic.ICollection<T>; otherwise, false.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

| Improve this Doc View Source

IsIEnumerableT(Type)

Checks if the given type implements System.Collections.Generic.IEnumerable<T>

Declaration
public static bool IsIEnumerableT(this Type type)
Parameters
Type Name Description
System.Type type

The type to check.

Returns
Type Description
System.Boolean

Returns a value of true if the given type implements System.Collections.Generic.IEnumerable<T>; otherwise, false.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

| Improve this Doc View Source

IsIListT(Type)

Checks if the given type implements System.Collections.Generic.IList<T>

Declaration
public static bool IsIListT(this Type type)
Parameters
Type Name Description
System.Type type

The type to check.

Returns
Type Description
System.Boolean

Returns a value of true if the given type implements System.Collections.Generic.IList<T>; otherwise, false.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

| Improve this Doc View Source

IsMicrosoftType(Type)

Checks if th given type is a Microsoft type, based on the company attribute of it's declaring assembly.

Declaration
public static bool IsMicrosoftType(this Type type)
Parameters
Type Name Description
System.Type type

The type to check.

Returns
Type Description
System.Boolean

Returns a value of true if the given type is a Microsoft type; otherwise, false.

Exceptions
Type Condition
System.ArgumentNullException

type can not be null.

  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX