10 2010 档案

摘要:protected void Page_Load(object sender, EventArgs e){ string series, category; if (!IsPostBack) {string series1 = Series(out series); string category1 = Category(out category); string cseries = series... 阅读全文
posted @ 2010-10-26 08:50 gull 阅读(381) 评论(0) 推荐(0)
摘要:public delegate void Feedback(object value,Int32 item,Int32 numItems);当编译器遇到这段代码时,它会产生如下面所示的一个完整的类定义public class Feedback : MulticastDelegate { public Feedback(object target, Int32 methodPro); public ... 阅读全文
posted @ 2010-10-23 12:58 gull 阅读(364) 评论(0) 推荐(0)
摘要:class MailManager { //传递给事件接受者的类型定义信息 public class MailMsgEventAgs : EventArgs { public readonly String from, to, subject, body; public MailMsgEventAgs(String from, String to, String subject, String b... 阅读全文
posted @ 2010-10-23 10:46 gull 阅读(437) 评论(0) 推荐(0)
摘要:class ClassWithDelegate { public delegate int DelegateThatReturnsInt(); public DelegateThatReturnsInt theDelegate; public void Run() { for (; ; ) { Thread.Sleep(500); if (theDelegate != null) {//第一... 阅读全文
posted @ 2010-10-21 21:11 gull 阅读(245) 评论(0) 推荐(0)
摘要:这是一个委托排序的例子public enum Comparsion { theFirstComesFirst=1, theSecondComesFirst=2 } //来决定排序的顺序class Pair<T> //在下面我创建的两个类Student,Dog,都把他们保存在Pair里面{ private T[] thePair = new T[2]; public delegate... 阅读全文
posted @ 2010-10-21 09:28 gull 阅读(269) 评论(0) 推荐(0)
摘要:IsMaych 我列举的其中的一种public static void RunIsMatch() { string inputString = "Welcome to the publishers, Wrox Pree Ltd"; if (Regex.IsMatch(inputString, "wrox pree", RegexOptions.IgnoreCase))//匹配在inputStrin... 阅读全文
posted @ 2010-10-20 08:56 gull 阅读(305) 评论(0) 推荐(0)
摘要:public static void output() { String s = "aa,bb,cc dd, ee"; const char comma = ','; const char space = ' '; char[] schar = new char[] { comma, space }; foreach (String s1 in s.Split(schar)) { Console... 阅读全文
posted @ 2010-10-19 11:04 gull 阅读(242) 评论(0) 推荐(0)
摘要:class Class1 { public void Display(params int[] values) //定义一个参数不限定 { foreach (int val in values) { Console.WriteLine("Class1:{0}",val.ToString()); } } }Class1 class1 = new Class1(); Int32[] digiTal... 阅读全文
posted @ 2010-10-18 15:38 gull 阅读(186) 评论(0) 推荐(0)
摘要:public struct Location { private int _xVal; private int _yVal; public Location(int xCoordinate, int yCoordinate) { _xVal = xCoordinate; _yVal = yCoordinate; }public int xVal { get { return xVal; } set... 阅读全文
posted @ 2010-10-18 13:03 gull 阅读(247) 评论(0) 推荐(0)
摘要:class Fraction { private int _numerator; private int _denominator; public Fraction(int numerator, int denominator) { this._numerator = numerator; this._denominator = denominator; } public overrid... 阅读全文
posted @ 2010-10-18 10:21 gull 阅读(565) 评论(0) 推荐(0)
摘要:enumColor:byte{ Red, Green, Blue, Orange}Console.WriteLine(Enum.GetUnderlyingType(typeof(Color))); //输出枚举类型Color c = Color.Blue; Console.WriteLine(c.ToString());//转化为字符串 Console.WriteLine(c.ToString(... 阅读全文
posted @ 2010-10-15 08:46 gull 阅读(299) 评论(0) 推荐(0)
摘要:StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} {1}", "Jeffrey", "Richer").Replace(" ","-");String s = sb.ToString().ToUpper();sb.Length = 0; sb.Append(s).Insert(8, "Marc-"); s = sb.ToSt... 阅读全文
posted @ 2010-10-13 09:18 gull 阅读(3742) 评论(0) 推荐(0)