c# - Using methods on Generics -


i have ton of methods this:

public uipcompanybutton addcompanybutton (string name, company company, uieventlistener.voiddelegate methodtocall, gameobject contents) {     return uipcompanybutton.create (name, company, methodtocall, contents); } 

that i'd replace single method this:

    public t addbutton<t,k>(string name, k item, uieventlistener.voiddelegate methodtocall, gameobject contents) t:uipmenubutton {     return t.create(name, item, methodtocall, contents); } 

which doesn't work @ t.create part. there syntax need this?

i'm open different method same result: single method takes in derived menubutton , creates right 1 right class of "item".

no, can't call static methods on generic types - not without reflection. aside else, there's no way of constraining generic type have specific static members. closest parameterless constructor constraint.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -