lundi 22 juin 2015

C# - Get all types that been used in class A

how can I get all the types that been used in specific type?

Example for class "MyClass":

[MyAttribute(new OtherType(TestEnum.EnumValue1))]
public class MyClass:MyOtherClass
{
    public Type MyType { get; set; }
    public string MyString { get; set; }

    private DateTime MyDateTime;
    [OtherAttribute()]
    public int MyMethod(double doubleNumber, float floatNumber)
    {
        justMyClass myClass = new justMyClass();
        return (int)doubleNumber / (int)floatNumber;
    }
}

I want to get the types: MyAttribute, OtherType, TestEnum, MyClass, MyOtherClass, Type, string, DateTime, OtherAttribute, int, double, float and justMyClass.

Is there any way to do it?





Aucun commentaire:

Enregistrer un commentaire