zoukankan      html  css  js  c++  java
  • 【转载】:C#语言

    http://www.cnblogs.com/qingxia/category/277351.html

    C#语言

     
    Question from one example in Item 5 《Effective C#》
    摘要: 1. Customer.csusing System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CSharp{ class Customer:IFormattable { public string Name { get; set; } public decimal Revenue { get; set; } public string ContactPhone { get; set; } string IFormattable.ToString(string format, I阅读全文
    posted @ 2011-04-17 12:15 Further 阅读(5) | 评论 (0) 编辑
    Debug DataBinding
    摘要: Debug Data Bindings Using an IValueConverterProblemYou need to debug a binding that is not working as expected and want to make sure the correct values are going in.SolutionCreate a converter class that implements System.Windows.Data.IValueConverter and returns the value it receives for conversion, 阅读全文
    posted @ 2011-03-10 17:02 Further 阅读(15) | 评论 (0) 编辑
    UML summarize
    摘要: 一. Three main elements in UML1. basic build block: thing, relationship, diagram2. rule: name, scope, visibility, integrity, execution3. common mechanism: specification, adornment, common division, extensiblity mechanism(stereotype, tag value, constraint)二. Relationship: dependency, association, gene阅读全文
    posted @ 2011-03-10 11:16 Further 阅读(15) | 评论 (0) 编辑
    OO设计原则
    摘要: 开闭原则(open/close principle, OCP): Open on extensibility , close on modification. We should use interface to encapsulation, use abstract mechanism, and use polymorphism.Liskov替换原则(Liskov Substitution Principle, LSP), 依赖倒置原则(Dependency Inversion Principle, DIP) depend on interface, instead of concrete 阅读全文
    posted @ 2011-03-10 10:14 Further 阅读(3) | 评论 (0) 编辑
    C# const, readonly, static readonly
    摘要: Const 定义的是静态常在对象初始化的时候赋值.以后不能改变它的值.属于编译时常量。不能用new初始化。Readonly 是只读变量.属于运行时变量.可以在类constructor里改变它的值.不能作用于局部变量。const 和 static 不能在一起用,它已经是静态的了。我们都知道,const和static readonly的确非常像:通过类名而不是对象名进行访问,在程式中只读等等。在多数情况下能混用。二者本质的差别在于,const的值是在编译期间确定的,因此只能在声明时通过常量表达式指定其值。而static readonly,在程式中只读, 不过它是在运行时计算出其值的,所以还能通过静阅读全文
    posted @ 2011-02-10 14:33 Further 阅读(17) | 评论 (0) 编辑
    C# Dictionary<string, int>
    摘要: C# Dictionary看似很像C++中的map,但是Dictionary不是按key排序的。map封装了二叉树算法,放入的key会自动升序排序。用迭代器++,就可读到排序后的key.阅读全文
    posted @ 2011-01-14 10:30 Further 阅读(110) | 评论 (0) 编辑
    C#的两种数据类型延伸之三--struct和class
    摘要: struct都能被class所代替, 那么为什么还要使用struct呢?存在即是合理的,struct在很多方面有着性能优势。让我们看看它们的主要区别在哪里?数据类型不一样,struct是值类型,class是引用类型,因此它们具有所有值类型和引用类型之间的差异。由于堆栈的执行效率要比堆的执行效率高,但是堆栈资源却很有限,不适合处理逻辑复杂的大对象,因此struct常用来处理作为基类型对待的小对象,而class来处理某个商业逻辑。从继承性来看,struct既不能继承也不能被继承,但是可以实现接口,而Class就可以完全扩展了。内部结构有区别,struct只能添加带参的构造函数,不能使用abstra阅读全文
    posted @ 2011-01-06 16:19 Further 阅读(19) | 评论 (0) 编辑
    C# string 拥有值类型特点的特殊引用类型 “字符串具有恒等性”
    摘要: String类型直接继承自Object,所以它是一个要new出来的引用类型,即线程的堆栈上不会驻留有任何字符串。(所有的值类型都继承自System.ValueType。值得指出的是System.ValueType却是一个引用类型)代码一:string str1 = "string"; string str2 = "stri"+"ng"; Console.WriteLine(string.ReferenceEquals(str1, str2));既然String类型是引用类型,那么代码一输出的应该是False,然而事实上代码一输出时的是阅读全文
    posted @ 2011-01-06 16:07 Further 阅读(133) | 评论 (0) 编辑
    c#中的interface abstract 与 virtual(转)
    摘要: interface用来声明接口Interface可以包含function, property, event, indexers; 函数方法不能用publicabstract、virtual等修饰。interface不可以包含构造函数、字段变量, interface的成员默认情况下是public的。1.只提供一些方法规约,不提供方法主体.如:publicinterfaceIPerson{voidgetName(string s);//不包含方法主体}一个例子(例1):publicinterfaceIPerson{IPerson();//错误stringname;//错误publicvoidget阅读全文
    做个快乐的自己。
  • 相关阅读:
    一、 IO 五种模型
    Spring核心IoC和AOP的理解
    spring读取properties文件配置使用
    Linux下的SVN服务器搭建
    Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
    时间戳函数
    用户,角色,权限对象
    程序翻译文本传输请求创建
    ALV值存放图标
    函数的异步、延迟调用
  • 原文地址:https://www.cnblogs.com/Jessy/p/2115251.html
Copyright © 2011-2022 走看看