Will GetType() return the most derived type when called from the base class?
Example:
public abstract class A
{
private Type GetInfo()
{
GetType
always returns the type that was actually instantiated. i.e. the most derived type. This means your GetSubType
behaves just like GetType
itself and thus is unnecessary.
To statically get the type information of some type you can use typeof(MyClass)
.
Your code has a mistake though: System.Attribute.GetCustomAttributes
returns Attribute[]
not Type
.