04 2013 档案

摘要:is: return true or falseView Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication6 7 { 8 abstract class Purchasedable 9 {10 11 }12 abstract class Moveable : Purchasedable13 {14 15 }16 abstrac... 阅读全文
posted @ 2013-04-25 11:14 若愚Shawn 阅读(156) 评论(0) 推荐(0)
摘要:Abstract的问题:Abstract也许看上去优美,有一般methrod,virtual methord,或者abstract metho 1 abstract class Car 2 { 3 abstract public void tALK(); 4 public void Drive() 5 { 6 Console.WriteLine("WROOOOOOM"); 7 } 8 public virtual void TruboBosst() 9 {10 ... 阅读全文
posted @ 2013-04-25 10:40 若愚Shawn 阅读(220) 评论(0) 推荐(0)
摘要:C# API有这样的功能:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication5 7 { 8 abstract class Person 9 {10 private string _name;11 public string Name12 {13 get { return _name; ... 阅读全文
posted @ 2013-04-24 16:07 若愚Shawn 阅读(281) 评论(0) 推荐(0)
摘要:一个类如果没有构造那么系统为我们在背后创建一个0参数的构造,但是一旦我们创建了但参数的构造,那么默认的构造就没了。View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication4 7 { 8 class Person 9 {10 private string _name;11 public Person(string name)12 ... 阅读全文
posted @ 2013-04-23 21:55 若愚Shawn 阅读(122) 评论(0) 推荐(0)
摘要:Property一般用来给field赋值:View Code 1 private string _name2 public string Name3 {4 get{return _name;}5 set{_name = value;}6 }可以给Field赋值的不只是property,也可以是constractor或者一个方法,但是如果我们想要向外暴露这个filed我们才需要写propertyView Code 1 class Person 2 { 3 private string _name 4 public Person(string name) 5 ... 阅读全文
posted @ 2013-04-23 21:52 若愚Shawn 阅读(265) 评论(0) 推荐(0)
摘要:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication3 7 { 8 abstract class EvenNumberGenerator 9 {10 public void Run(int min, int max)11 {12 for (int i = min; i < max; i++)13 ... 阅读全文
posted @ 2013-04-20 19:21 若愚Shawn 阅读(228) 评论(0) 推荐(0)
摘要:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication2 7 { 8 abstract class Item 9 {10 public abstract void Dispaly();11 public abstract void Use();12 }13 class Chair : Item14 {15... 阅读全文
posted @ 2013-04-20 17:06 若愚Shawn 阅读(384) 评论(0) 推荐(0)
摘要:Virtual memebers:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{ class Person { public string Firstname { get; set; } public string SecondName { get; set; } public virtual void Display() { C... 阅读全文
posted @ 2013-04-15 15:00 若愚Shawn 阅读(267) 评论(0) 推荐(0)
摘要:我们知道,一个类的方法从调用方式上可以分为“静态方法”与“非静态方法”(实例方法)。在.net框架中,也有很多这种公共静态方法。现在我想讨论一下,一个类为什么要提供静态方法以及在什么时候应该提供静态方法。静态方法与非静态方法最明显的区别就是如果某个方法是公共静态的,那么可以直接 通过类名.方法名的方法来调用,而公共实例方法则需要事先实例化对象,然后才能调用。很多人认为静态方法来速度上、在内存占用比值上要比实例方法快和多, 这一点我不认同。方法执行的快与慢在同等条件下主要决定于所要进行的操作,而静态方法要比实例方法占用更多的内存这一点更是毫无根据。一个类型加载的时 候,该类的所有的方法都会被加载 阅读全文
posted @ 2013-04-15 11:19 若愚Shawn 阅读(2182) 评论(0) 推荐(0)
摘要:One question that has been coming up frequently over the past few days has been how to launchthe browserwhen the user clicks on a hyperlink. The answer is different for thebrowser and standalone cases:Browser (XBAP or Loose XAML)XBAPs and looseXAMLsupport special named targets for Hyperlink; these a 阅读全文
posted @ 2013-04-11 15:21 若愚Shawn 阅读(3031) 评论(0) 推荐(0)