你可以用object代替public class Class1
{
public object GetValue(System.Type vType)
{
string typeName = vType.ToString();
switch(typeName)
{ case "System.Int32"
return 1;
case "System.String"
return "1";
default: return null;
}
}
}int i = (int)Class1.GetValue(typeof(int));
string text = (int)Class1.GetValue(typeof(string));
{
public object GetValue(System.Type vType)
{
string typeName = vType.ToString();
switch(typeName)
{ case "System.Int32"
return 1;
case "System.String"
return "1";
default: return null;
}
}
}int i = (int)Class1.GetValue(typeof(int));
string text = (int)Class1.GetValue(typeof(string));
web服务可以使用的类型:
String Char Byte
Boolean Int16 Int32
Int64 UInt16 UInt32
UInt64 Single Double
Guid Decimal DataTime
XmlQualifiedName Class struct
XmlNode DataSet enum
在c#中,所有的都 有一个共同的祖先object,然后用is ,as ,转换