Class PropretySpecType
- Namespace
- Dynamitey.DynamicObjects
- Assembly
- Dynamitey.Community.dll
A FauxType described by an explicit name-to-type map rather than by a real CLR type. Nothing is reflected over: every lookup is a dictionary read, which is what makes this the cheap option when the shape is already known.
public class PropretySpecType : FauxType
- Inheritance
-
PropretySpecType
- Inherited Members
Remarks
The name is misspelled - "Proprety" - and is kept that way deliberately. It is declared
public API in PublicAPI.Unshipped.txt, and correcting it would break the one-line package
swap that README.md promises consumers moving from the original package.
Constructors
PropretySpecType(IDictionary<string, Type>)
Initializes a new instance of the PropretySpecType class.
public PropretySpecType(IDictionary<string, Type> propertySpec)
Parameters
propertySpecIDictionary<string, Type>The member name to type map. It is stored by reference, not copied, so later changes to the caller's dictionary are visible through this instance.
Properties
PropertySpec
Gets the member name to type map backing this instance.
public IDictionary<string, Type> PropertySpec { get; }
Property Value
Methods
GetContainedTypes()
Gets the CLR types this instance stands in for.
public override Type[] GetContainedTypes()
Returns
- Type[]
Always empty. This type is defined by a name-to-type map rather than by wrapping real CLR types, so there is nothing to report - unlike RealType.
GetMember(string)
Gets the member matching binderName.
[RequiresUnreferencedCode("Matches FauxType.GetMember's abstract declaration; this override is itself a plain dictionary lookup and does no reflection.")]
public override IEnumerable<MemberInfo> GetMember(string binderName)
Parameters
binderNamestringThe member name to look up.
Returns
- IEnumerable<MemberInfo>
A single-element sequence holding the mapped type, or an empty sequence when the name is not in the map. Absence is reported as an empty result rather than an exception.
GetMemberNames()
Gets the names in the map.
[RequiresUnreferencedCode("Matches FauxType.GetMemberNames's abstract declaration; this override is itself a plain dictionary lookup and does no reflection.")]
public override IEnumerable<string> GetMemberNames()
Returns
- IEnumerable<string>
The map's keys, in the order the underlying dictionary yields them.