111,120
社区成员
发帖
与我相关
我的任务
分享
static void TestMethod<T>( T result)
{
How to check result's type here?
}
Type t = typeof(T);
static Type TestMethod<T>(T result)
{
Type type = result.GetType();
return type;
}
Type type =result.GetType();
Type type = typeof( T );
if ( result is int )
{
MessageBox.Show( "Int" );
}
else if ( result is Form )
{
MessageBox.Show( "Form" );
}
else
{
MessageBox.Show( "Other" );
}