inheritance - How does c# System.Type Type have a name property -
i'm pretty sure related implementing interfaces , inheritance.
in c# how system.type class have property name? when example code of type class metadata or using object browser see type class doesn't have:
string name
defined anywhere.
i see type inherits memberinfo , implements _type , ireflect (like this):
public abstract class type : memberinfo, _type, ireflect
the base class memberinfo has property:
public abstract string name { get; }
from know, has overridden in derived class because of abstract modifier. don't see in type...
then in _type interface there property:
string name { get; }
and because in interface has no implementation of own either.
where name getting defined , how have value in system.type class? or not understanding how inheritance , implementing interfaces works class
notice system.type
abstract class. means can overriden in subclass. in fact, can see types @ run-time not system.type
's if this:
typeof(type).gettype().fullname; // system.runtimetype
the system.runtimetype
internal type won't see in documentation, does override name
property. looks little this:
namespace system { internal class runtimetype : type, iserializable, icloneable { ... public override string name { { ... } } } }
see note in official documentation:
type abstract base class allows multiple implementations. system provide derived class runtimetype. in reflection, classes beginning word runtime created once per object in system , support comparison operations.
Comments
Post a Comment