class TestUsing:IDisposable { public void Dispose() { Console.WriteLine("Dispose"); } public void Method() { Console.WriteLine("Do a method"); } } |
using(TestUsing tu=new TestUsing()) { tu.Method(); } |
expression as type |
expression is type ? (type)expression : (type)null |
object [] arr=new object[2]; arr[0]=123; arr[1]="test"; foreach(object o in arr) { string s=(string)o; Console.WriteLine(s); } |
object [] arr=new object[2]; arr[0]=123; arr[1]="test"; for(int i=0;i<arr.Length;i++) { string s=arr[i] as string; if(s!=null)Console.WriteLine(i+":"+s); } |
欢迎访问最专业的网吧论坛,无盘论坛,网吧经营,网咖管理,网吧专业论坛
https://bbs.txwb.com
关注天下网吧微信/下载天下网吧APP/天下网吧小程序,一起来超精彩
|
本文来源:vczx 作者:佚名