oop - C# Passing a class type as a parameter -


this c#? passing class type parameter

i have class adapter implements interface. want fill array structure myfooclass instances myfooclass's name or reference want receive outside. i'll instantiate them inside adapter code.

for example:

    public void fillwsvcstructs(dataset ds, classtype baz)     {         ifoo.request = ds.datatable[0].request;         ifoo.modulebq = string.empty;         ifoo.clasific = string.empty;         ifoo.asignadoa = ds.datatable[0].referer;         ifoo.solicita = "jean paul goitier";           // go sub-elems (also "interfaceated")         foreach (dataset.datatablerow ar in ds.datatable[1])         {             if ((int) ar.statusot != (int)props.statusot.notot)             {                 ///from here!                 ielemrequest req = new (baz)(); // don't know how here                 ///to here!                  req.id = string.empty;                 req.type = string.empty;                 req.num = string.empty;                 req.message = string.empty;                 req.trkorr = ar[1];                 trequest.add(req);             }         }     } 

generics , their constraints should want, believe:

public void fillwsvcstructs<classtype>(dataset ds) classtype : ielemrequest, new() {     ifoo.request = ds.datatable[0].request;     ifoo.modulebq = string.empty;     ifoo.clasific = string.empty;     ifoo.asignadoa = ds.datatable[0].referer;     ifoo.solicita = "jean paul goitier";       // go sub-elems (also "interfaceated")     foreach (dataset.datatablerow ar in ds.datatable[1])     {         if ((int) ar.statusot != (int)props.statusot.notot)         {             ielemrequest req = new classtype();              req.id = string.empty;             req.type = string.empty;             req.num = string.empty;             req.message = string.empty;             req.trkorr = ar[1];             trequest.add(req);         }     } } 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -