Show / Hide Table of Contents

Class RuntimeTypeInfo

Provides optimized access to methods and properties at runtime.

Inheritance
System.Object
System.Dynamic.DynamicObject
ExpandoBase
Expando
RuntimeTypeInfo
RuntimeEntityInfo
RuntimeMessageInfo
RuntimeActivityInfo
Implements
IRuntimeTypeInfo
ITypeInfo
IRuntimeElementInfo
IElementInfo
IExpando
System.Dynamic.IDynamicMetaObjectProvider
IIndexable
IAttributeProvider
Inherited Members
ExpandoBase.Item[String]
ExpandoBase.GetDynamicMemberNames()
ExpandoBase.HasDynamicMember(String)
ExpandoBase.TryGetMember(GetMemberBinder, Object)
ExpandoBase.TrySetMember(SetMemberBinder, Object)
ExpandoBase.TryInvokeMember(InvokeMemberBinder, Object[], Object)
ExpandoBase.ToDictionary(Func<String, String>, Func<Object, Object>)
ExpandoBase.GetInnerObjectTypeInfo()
ExpandoBase.TryGetValue(String, Object)
ExpandoBase.TrySetValue(String, Object)
System.Dynamic.DynamicObject.GetMetaObject(System.Linq.Expressions.Expression)
System.Dynamic.DynamicObject.TryBinaryOperation(System.Dynamic.BinaryOperationBinder, System.Object, System.Object)
System.Dynamic.DynamicObject.TryConvert(System.Dynamic.ConvertBinder, System.Object)
System.Dynamic.DynamicObject.TryCreateInstance(System.Dynamic.CreateInstanceBinder, System.Object[], System.Object)
System.Dynamic.DynamicObject.TryDeleteIndex(System.Dynamic.DeleteIndexBinder, System.Object[])
System.Dynamic.DynamicObject.TryDeleteMember(System.Dynamic.DeleteMemberBinder)
System.Dynamic.DynamicObject.TryGetIndex(System.Dynamic.GetIndexBinder, System.Object[], System.Object)
System.Dynamic.DynamicObject.TryInvoke(System.Dynamic.InvokeBinder, System.Object[], System.Object)
System.Dynamic.DynamicObject.TrySetIndex(System.Dynamic.SetIndexBinder, System.Object[], System.Object)
System.Dynamic.DynamicObject.TryUnaryOperation(System.Dynamic.UnaryOperationBinder, System.Object)
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)
Namespace: Kephas.Runtime
Assembly: Kephas.Core.dll
Syntax
public class RuntimeTypeInfo : Expando, IRuntimeTypeInfo, ITypeInfo, IRuntimeElementInfo, IElementInfo, IExpando, IDynamicMetaObjectProvider, IIndexable, IAttributeProvider

Constructors

| Improve this Doc View Source

RuntimeTypeInfo(Type)

Initializes a new instance of the RuntimeTypeInfo class.

Declaration
protected RuntimeTypeInfo(Type type)
Parameters
Type Name Description
System.Type type

The type.

Properties

| Improve this Doc View Source

Annotations

Gets the element annotations.

Declaration
public IEnumerable<object> Annotations { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Object>

The element annotations.

| Improve this Doc View Source

BaseTypes

Gets the bases of this ITypeInfo. They include the real base and also the implemented interfaces.

Declaration
public IEnumerable<ITypeInfo> BaseTypes { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ITypeInfo>

The bases.

| Improve this Doc View Source

CreateRuntimeTypeInfo

Gets or sets the function for creating the runtime type information.

Declaration
public static Func<Type, IRuntimeTypeInfo> CreateRuntimeTypeInfo { get; set; }
Property Value
Type Description
System.Func<System.Type, IRuntimeTypeInfo>

The function for creating the runtime type information.

| Improve this Doc View Source

DeclaringContainer

Gets the parent element declaring this element.

Declaration
public IElementInfo DeclaringContainer { get; }
Property Value
Type Description
IElementInfo

The declaring element.

| Improve this Doc View Source

DefaultValue

Gets the default value of the type.

Declaration
public object DefaultValue { get; }
Property Value
Type Description
System.Object

The default value.

| Improve this Doc View Source

Fields

Gets the fields.

Declaration
public IDictionary<string, IRuntimeFieldInfo> Fields { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, IRuntimeFieldInfo>

The fields.

| Improve this Doc View Source

FullName

Gets the full name of the element.

Declaration
public string FullName { get; }
Property Value
Type Description
System.String

The full name of the element.

| Improve this Doc View Source

GenericTypeArguments

Gets a read-only list of ITypeInfo objects that represent the type arguments of a closed generic type.

Declaration
public IReadOnlyList<ITypeInfo> GenericTypeArguments { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyList<ITypeInfo>

The generic arguments.

| Improve this Doc View Source

GenericTypeDefinition

Gets a ITypeInfo object that represents a generic type definition from which the current generic type can be constructed.

Declaration
public ITypeInfo GenericTypeDefinition { get; }
Property Value
Type Description
ITypeInfo

The generic type definition.

| Improve this Doc View Source

GenericTypeParameters

Gets a read-only list of ITypeInfo objects that represent the type parameters of a generic type definition (open generic).

Declaration
public IReadOnlyList<ITypeInfo> GenericTypeParameters { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyList<ITypeInfo>

The generic arguments.

| Improve this Doc View Source

Kind

Gets the runtime type kind.

Declaration
public RuntimeTypeKind Kind { get; }
Property Value
Type Description
RuntimeTypeKind

The runtime type kind.

| Improve this Doc View Source

Members

Gets the members.

Declaration
public IDictionary<string, IRuntimeElementInfo> Members { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, IRuntimeElementInfo>

The members.

| Improve this Doc View Source

Methods

Gets the runtime methods.

Declaration
public IDictionary<string, ICollection<IRuntimeMethodInfo>> Methods { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.ICollection<IRuntimeMethodInfo>>

The runtime methods.

| Improve this Doc View Source

Name

Gets the name of the type.

Declaration
public string Name { get; }
Property Value
Type Description
System.String

The name of the type.

| Improve this Doc View Source

Namespace

Gets the namespace of the type.

Declaration
public string Namespace { get; }
Property Value
Type Description
System.String

The namespace of the type.

| Improve this Doc View Source

Properties

Gets the runtime properties.

Declaration
public IDictionary<string, IRuntimePropertyInfo> Properties { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, IRuntimePropertyInfo>

The runtime properties.

| Improve this Doc View Source

QualifiedFullName

Gets the full name qualified with the module where it was defined.

Declaration
public string QualifiedFullName { get; }
Property Value
Type Description
System.String

The full name qualified with the module.

| Improve this Doc View Source

Type

Gets the type.

Declaration
public Type Type { get; }
Property Value
Type Description
System.Type

The type.

| Improve this Doc View Source

TypeInfo

Gets the underlying TypeInfo.

Declaration
public TypeInfo TypeInfo { get; }
Property Value
Type Description
System.Reflection.TypeInfo

The type.

Methods

| Improve this Doc View Source

CreateFieldInfos(Type, Func<FieldInfo, Boolean>)

Creates the fields.

Declaration
protected virtual IDictionary<string, IRuntimeFieldInfo> CreateFieldInfos(Type type, Func<FieldInfo, bool> criteria = null)
Parameters
Type Name Description
System.Type type

The type.

System.Func<System.Reflection.FieldInfo, System.Boolean> criteria

Optional. The criteria.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, IRuntimeFieldInfo>

A dictionary of fields.

| Improve this Doc View Source

CreateInstance(IEnumerable<Object>)

Creates an instance with the provided arguments (if any).

Declaration
public object CreateInstance(IEnumerable<object> args = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Object> args

The arguments.

Returns
Type Description
System.Object

The new instance.

| Improve this Doc View Source

CreateMemberInfos(Action<IDictionary<String, IRuntimeElementInfo>>)

Creates the member infos.

Declaration
protected virtual IDictionary<string, IRuntimeElementInfo> CreateMemberInfos(Action<IDictionary<string, IRuntimeElementInfo>> membersConfig = null)
Parameters
Type Name Description
System.Action<System.Collections.Generic.IDictionary<System.String, IRuntimeElementInfo>> membersConfig

Optional. The members configuration.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, IRuntimeElementInfo>

The new member infos.

| Improve this Doc View Source

CreateMembers<TRuntimeMemberInfo, TMemberInfo>(Type, IEnumerable<TRuntimeMemberInfo>, Func<TRuntimeMemberInfo, Type>, Func<TRuntimeMemberInfo, Boolean>)

Creates the members.

Declaration
protected static IDictionary<string, TMemberInfo> CreateMembers<TRuntimeMemberInfo, TMemberInfo>(Type type, IEnumerable<TRuntimeMemberInfo> runtimeMembers, Func<TRuntimeMemberInfo, Type> memberTypeGetter, Func<TRuntimeMemberInfo, bool> criteria = null)

    where TRuntimeMemberInfo : MemberInfo
Parameters
Type Name Description
System.Type type

The type.

System.Collections.Generic.IEnumerable<TRuntimeMemberInfo> runtimeMembers

The runtime members.

System.Func<TRuntimeMemberInfo, System.Type> memberTypeGetter

The member type getter.

System.Func<TRuntimeMemberInfo, System.Boolean> criteria

Optional. The criteria.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, TMemberInfo>

A dictionary of members.

Type Parameters
Name Description
TRuntimeMemberInfo

Type of the runtime member.

TMemberInfo

Type of the member.

| Improve this Doc View Source

CreatePropertyInfos(Type, Func<PropertyInfo, Boolean>)

Creates the properties.

Declaration
protected virtual IDictionary<string, IRuntimePropertyInfo> CreatePropertyInfos(Type type, Func<PropertyInfo, bool> criteria = null)
Parameters
Type Name Description
System.Type type

The container type.

System.Func<System.Reflection.PropertyInfo, System.Boolean> criteria

The criteria.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, IRuntimePropertyInfo>

A dictionary of properties.

| Improve this Doc View Source

GetAttributes<TAttribute>()

Gets the attribute of the provided type.

Declaration
public IEnumerable<TAttribute> GetAttributes<TAttribute>()

    where TAttribute : Attribute
Returns
Type Description
System.Collections.Generic.IEnumerable<TAttribute>

The attribute of the provided type.

Type Parameters
Name Description
TAttribute

Type of the attribute.

| Improve this Doc View Source

GetMember(String, Boolean)

Gets a member by the provided name.

Declaration
public IElementInfo GetMember(string name, bool throwIfNotFound = true)
Parameters
Type Name Description
System.String name

The name.

System.Boolean throwIfNotFound

True to throw if the requested member is not found.

Returns
Type Description
IElementInfo

The requested member, or null.

| Improve this Doc View Source

GetThisTypeInfo()

Gets the IRuntimeTypeInfo of this expando object.

Declaration
protected override ITypeInfo GetThisTypeInfo()
Returns
Type Description
ITypeInfo

The IRuntimeTypeInfo of this expando object.

Overrides
ExpandoBase.GetThisTypeInfo()
| Improve this Doc View Source

GetUnderlyingElementInfo()

Gets the underlying member information.

Declaration
public ICustomAttributeProvider GetUnderlyingElementInfo()
Returns
Type Description
System.Reflection.ICustomAttributeProvider

The underlying member information.

| Improve this Doc View Source

GetValue(Object, String)

Gets the value of the property with the specified name.

Declaration
public object GetValue(object instance, string propertyName)
Parameters
Type Name Description
System.Object instance

The instance.

System.String propertyName

Name of the property.

Returns
Type Description
System.Object

The value of the specified property.

Remarks

If a property with the provided name is not found, an exception occurs.

| Improve this Doc View Source

Invoke(Object, String, IEnumerable<Object>)

Invokes the specified method on the provided instance.

Declaration
public object Invoke(object instance, string methodName, IEnumerable<object> args)
Parameters
Type Name Description
System.Object instance

The instance.

System.String methodName

Name of the method.

System.Collections.Generic.IEnumerable<System.Object> args

The arguments.

Returns
Type Description
System.Object

The invocation result.

| Improve this Doc View Source

MakeGenericType(IEnumerable<ITypeInfo>, IContext)

Constructs a generic type baed on the provided type arguments.

Declaration
public ITypeInfo MakeGenericType(IEnumerable<ITypeInfo> typeArguments, IContext constructionContext = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ITypeInfo> typeArguments

The type arguments.

IContext constructionContext

The construction context (optional).

Returns
Type Description
ITypeInfo

A constructed ITypeInfo.

| Improve this Doc View Source

RegisterFactory(IRuntimeTypeInfoFactory)

Registers a factory used to create IRuntimeTypeInfo instances.

Declaration
public static void RegisterFactory(IRuntimeTypeInfoFactory factory)
Parameters
Type Name Description
IRuntimeTypeInfoFactory factory

The factory.

Remarks

Factories are called in the inverse order of their addition, meaning that the last added factory is invoked first. This is by design, so that the non-framework code has a change to override the default behavior.

| Improve this Doc View Source

SetValue(Object, String, Object)

Sets the value of the property with the specified name.

Declaration
public void SetValue(object instance, string propertyName, object value)
Parameters
Type Name Description
System.Object instance

The instance.

System.String propertyName

Name of the property.

System.Object value

The value.

Remarks

If a property with the provided name is not found, an exception occurs.

| Improve this Doc View Source

ToString()

Returns a string that represents the current object.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string that represents the current object.

Overrides
System.Object.ToString()
| Improve this Doc View Source

TryGetValue(Object, String, out Object)

Gets the value of the property with the specified name.

Declaration
public bool TryGetValue(object instance, string propertyName, out object value)
Parameters
Type Name Description
System.Object instance

The instance.

System.String propertyName

Name of the property.

System.Object value

The property value.

Returns
Type Description
System.Boolean

A boolean value indicating whether the property is found.

| Improve this Doc View Source

TryInvoke(Object, String, IEnumerable<Object>, out Object)

Tries to invokes the specified method on the provided instance.

Declaration
public bool TryInvoke(object instance, string methodName, IEnumerable<object> args, out object result)
Parameters
Type Name Description
System.Object instance

The instance.

System.String methodName

Name of the method.

System.Collections.Generic.IEnumerable<System.Object> args

The arguments.

System.Object result

The invocation result.

Returns
Type Description
System.Boolean

A boolean value indicating whether the invocation was successful or not.

| Improve this Doc View Source

TrySetValue(Object, String, Object)

Tries to set the value of the property with the specified name.

Declaration
public bool TrySetValue(object instance, string propertyName, object value)
Parameters
Type Name Description
System.Object instance

The instance.

System.String propertyName

Name of the property.

System.Object value

The value.

Returns
Type Description
System.Boolean

true if the value could be set; otherwise false.

Remarks

If a property with the provided name is not found, the method just returns.

Explicit Interface Implementations

| Improve this Doc View Source

ITypeInfo.Members

Gets the members.

Declaration
IEnumerable<IElementInfo> ITypeInfo.Members { get; }
Returns
Type Description
System.Collections.Generic.IEnumerable<IElementInfo>

The members.

| Improve this Doc View Source

ITypeInfo.Properties

Gets the enumeration of properties.

Declaration
IEnumerable<IPropertyInfo> ITypeInfo.Properties { get; }
Returns
Type Description
System.Collections.Generic.IEnumerable<IPropertyInfo>

Implements

IRuntimeTypeInfo
ITypeInfo
IRuntimeElementInfo
IElementInfo
IExpando
System.Dynamic.IDynamicMetaObjectProvider
IIndexable
IAttributeProvider

Extension Methods

DynamicObjectExtensions.SetPropertyValue(Object, String, Object)
DynamicObjectExtensions.TrySetPropertyValue(Object, String, Object)
DynamicObjectExtensions.GetPropertyValue(Object, String)
DynamicObjectExtensions.TryGetPropertyValue(Object, String, out Object)
DynamicObjectExtensions.GetRuntimeTypeInfo(Object)
DynamicObjectExtensions.ToDynamic(Object)
DynamicObjectExtensions.ToExpando(Object)
BehaviorValue.ToBehaviorValue<TValue>(TValue)
CollectionExtensions.AddRange<T, TItem>(T, IEnumerable<TItem>)
ExpandoExtensions.Merge<T>(T, Object)
ExpandoExtensions.GetLaxValue<T>(IIndexable, String, T)
LoggingExtensions.GetLogger(Object, IContext)
TypeExtensions.GetAbstractTypeInfo(ITypeInfo)
TypeExtensions.GetAbstractType(ITypeInfo)
TypeExtensions.GetAbstractType(Object)
TypeExtensions.GetAbstractTypeInfo(Object)
LocalizationHelper.GetLocalization(ITypeInfo)
ReflectionHelper.GetTypeInfo(Object)
TypeInfoExtensions.AsType(ITypeInfo)
TypeInfoExtensions.IsGenericType(ITypeInfo)
TypeInfoExtensions.IsGenericTypeDefinition(ITypeInfo)
TypeInfoExtensions.IsConstructedGenericType(ITypeInfo)
TypeInfoExtensions.GetDeclaredMembers(ITypeInfo)
AttributeProviderExtensions.GetAttribute<TAttribute>(IAttributeProvider)
RuntimeTypeInfoExtensions.CreateInstance(IRuntimeTypeInfo, Object[])
RuntimeTypeInfoExtensions.GetClassifierKind(IRuntimeTypeInfo)
RuntimeTypeInfoExtensions.IsExcludedFromModel(IAttributeProvider)
RuntimeTypeInfoExtensions.IsModelType(IRuntimeTypeInfo)
EntityEntryExtensions.TryGetAttachedEntityEntry(Object)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX