这似乎是可能的。
protected SameObjectTypeAsInputParameterObjectType GetAValue(someObject,TypeOrReturnObjectYouWant){
//check to see if someObject is null, if not, cast it and send the cast back
}发布于 2010-01-15 21:17:47
使用泛型:
T foobar<T>() where T : new()
{
return new T();
}
void somefunc()
{
Guid g = foobar<Guid>();
}https://stackoverflow.com/questions/2071681
复制相似问题