nullable form general parameter possible?


i wish something :



myyear = record.getvalueornull<int?>("myyear"),


notice nullable form general parameter.



since getvalueornull duty relapse zero initial try this:



public stationary t getvalueornull<t>(this dbdatarecord reader, twine columnname)
where t : class
{
vigilant columnvalue = reader[columnname];

(!(columnvalue dbnull))
{
relapse (t)columnvalue;
}
relapse null;
}


but blunder i'm removing is:




the form 'int?' contingency anxiety form method parameter 't' general form method




right! nullable<int> struct! i attempted changing category imprisonment struct imprisonment (and side outcome can't relapse null any more):



public stationary t getvalueornull<t>(this dbdatarecord reader, twine columnname)
where t : struct


now assignment:



myyear = record.getvalueornull<int?>("myyear");


gives following error:




the form 'int?' contingency non-nullable value form method parameter 't' general form method




is naming nullable form general parameter during possible?



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?