上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 63 下一页
摘要: classProgram{staticvoidMain(string[]args){intnum=10;num.SayGoodNews();//输出hehestringresult=num.GetSomeString(100,50);Console.Write(result);//输出150Console.Read();}} staticclassIntExtension//注意为某个类中添加扩展方法,必须是静态类{publicstaticvoidSayGoodNews(thisintx)//不带参数的扩展方法使用{Console.Write(x);} publicstaticstringG. 阅读全文
posted @ 2013-04-11 20:03 Predator 阅读(200) 评论(0) 推荐(0) 编辑
摘要: //获取程序集的特性方法public string AssemblyTitle{get{object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);if(attributes.Length > 0){AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];if(titleAttribute.Title != "&qu 阅读全文
posted @ 2013-04-11 19:18 Predator 阅读(362) 评论(0) 推荐(0) 编辑
摘要: //内部定义类使用using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConTest{ class Cow { private string name; public class Chicken { private int foots; public int Foots { get { return foots; } set { foots = value; } } private string name; public string Name { get { r 阅读全文
posted @ 2013-04-11 19:17 Predator 阅读(249) 评论(0) 推荐(0) 编辑
摘要: System.Threading.Thread.Sleep(2000); Console.WriteLine("Has Conme"); long start = DateTime.Now.Ticks; long end = DateTime.Now.Ticks; long span = end - start; while (true) { if (span>=20000000)//等于2秒的时候输出 { Console.WriteLine("Has Conme"); break; } end = DateTime.Now.Ticks; span 阅读全文
posted @ 2013-04-11 19:15 Predator 阅读(284) 评论(0) 推荐(0) 编辑
上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 63 下一页