c# - Getting the current type in a static, generic method? -
I have found an intangible class like this;
Share of Public Intangible Assets {Public Stable System.Type GetMyType () {Return !!! Here are some magic !!! }}
I want to subdivide it, and when I call GetMyType () stable, I want to return the type of subclass if I declare a subtype;
Public class Concreteproperty: Propertybase {}
then when I call
var typename = concreteprote.gate MyType () Name;
I hope that the 'Type' name should be set to "Concreteproperty". I suspect there is no way to do this, but I am interested in it if someone knows a way to get this information.
(Dependency attribute WPF; I am trying to solve the problem I want to be able to do something like this;
class named object: Dependency Objects {// declare the property of a name as a type of name, not an example. Private class NameProperty: PropertyBase & lt; string, nombed object & gt; {} // call static methods to read class The public string of property on class {return nameProperty.Get} (This);} Set {NameProperty.Set} (this, value);}}}
and I have an implementation of Approximately , but I want to get my name property You can get partial access to the generic use (1-level legacy is dark):
Code> class PropertyBase & lt; T & gt; Class = "text" {public static type GetMyType () {return type (t); }} // Base class is actually a generic specialty class type class concrete property: Properties and lieutenants; Concreteprotecti & gt; {/ * More code here * /} // t == type (concreteproperty) var t = concreteproperty.getmetty ();
Comments
Post a Comment