System.RuntimeType

0

Czy wiecie coś o klasie System.RuntimeType? Debugger pokazuje taki typ, ponoć jego klasą bazową jest System.Type. Piszę "ponoć", bo nie mogę opisu tej klasy znaleźć na MSDN.

Konkretnie chodzi mi o metodę GetCustomAttributes wywoływaną na obiekcie typu Type. Jest na nim abstrakcyjna, więc pewnie w System.RuntimeType jest jej implementacja. Po migracji z 1.1 do 2.0 przestało mi to działać, więc przypuszczam, że zmieniła się implementacja tej metody, ale nie wiem gdzie to sprawdzić.

0

Typ związany z mechanizmem refleksji.

Wynik wyszukania w '.NET Reflector':

internal class RuntimeType : Type, ISerializable, ICloneable
Name: System.RuntimeType
Assembly: mscorlib, Version=2.0.0.0

Tu masz implementacje :

public override object[] GetCustomAttributes(bool inherit)
{
    return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType, inherit);
}

 
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
{
    if (attributeType == null)
    {
        throw new ArgumentNullException("attributeType");
    }
    RuntimeType underlyingSystemType = attributeType.UnderlyingSystemType as RuntimeType;
    if (underlyingSystemType == null)
    {
        throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), "attributeType");
    }
    return CustomAttribute.GetCustomAttributes(this, underlyingSystemType, inherit);
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1