c# - Is it possible to add to class extension method via attribute? -
say have simple class tree:
public class operation {     public int callback; }  public class operationresponse : operation { } now love add new class operationrequest have simple extension method like:
public static class extensions {     public static t getresponse<t>(this operation source) t : operation {         return new t{ callback = source.callback };     }  } i love define like:
[response(operationresponse)] public class operationrequest { } and have extension specified getresponse<operationresponse>. such thing possible attributes in .net4 , how it?
technically can have such of sort though complicated structure @ run time. impossible have design time intellisense extension provide. attribute more of run time behavior.
Comments
Post a Comment