using System;
using System.Collections.Generic;
using System.Text;
public class Test2
{
public void aaB(string a, int b)
{
if(a!=null)
{
Console.WriteLine("The stirng is " + a + ", the number is " + b);
}
else
{
Console.WriteLine("error");
}
}
public void checkType(object type)
{
Console.WriteLine("The "+type+" type is {0},", type.GetType());
}
public static void Main()
{
Test2 ts = new Test2();
string a="my name is a";
int b=3662296;
ts.aaB(a,b);
int i = 5;
string k="哈,今天的天氣不錯,我叫string ";
Console.WriteLine("i is an int ? {0}" , i.GetType() == typeof(int));
Console.WriteLine("i is an int ? {0}" , typeof(int).IsInstanceOfType(i));
Console.WriteLine("k is an int ? {0}" , typeof(int).IsInstanceOfType(k));
Console.WriteLine("The type of k is {0},",k.GetType());
ts.checkType(k);
ts.checkType(i);
}
}
using System.Collections.Generic;
using System.Text;
public class Test2
{
public void aaB(string a, int b)
{
if(a!=null)
{
Console.WriteLine("The stirng is " + a + ", the number is " + b);
}
else
{
Console.WriteLine("error");
}
}
public void checkType(object type)
{
Console.WriteLine("The "+type+" type is {0},", type.GetType());
}
public static void Main()
{
Test2 ts = new Test2();
string a="my name is a";
int b=3662296;
ts.aaB(a,b);
int i = 5;
string k="哈,今天的天氣不錯,我叫string ";
Console.WriteLine("i is an int ? {0}" , i.GetType() == typeof(int));
Console.WriteLine("i is an int ? {0}" , typeof(int).IsInstanceOfType(i));
Console.WriteLine("k is an int ? {0}" , typeof(int).IsInstanceOfType(k));
Console.WriteLine("The type of k is {0},",k.GetType());
ts.checkType(k);
ts.checkType(i);
}
}
作者:Else 's Blog
地址:http://www.aixq.com/post/890/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
中查看更多“C#數據類型判斷”相关内容
中查看更多“C#數據類型判斷”相关内容
中查看更多“C#數據類型判斷”相关内容
中查看更多“C#數據類型判斷”相关内容
中查看更多“C#數據類型判斷”相关内容
中查看更多“C#數據類型判斷”相关内容
原来可以这么简单,只是没有动手,关于et的多级分类显示
php地址栏的参数


2007/12/19 15:35 | by 
