C# tips
来源:互联网 发布:qq群自定义群地址优化 编辑:程序博客网 时间:2024/05/08 14:28
1. .NET 3.0 introduces a new concept of Auto-implemented properties. In short you can do things like: public class MyClass { public int X { get; set; } } Instead of: public class MyClass { private int _x; public int X { get { return _x; } set { _x = value; } } } 2. C# offers the ability to make things like ‘int’ a nullable type. int? x = null; if (x == null || !x.HasValue) { x = 5; } Console.WriteLine(x.ToString()); 3. Aliases make it easier for you to shortcut to your most common called classes. using c = System.Console; using myMethod = System.Reflection.MethodBase; class Program { static void Main(string[] args) { c.WriteLine(myMethod.GetCurrentMethod().Name); } } 4. A favorite shortcut of mine is ‘Ctrl+R+M’ lets you turn any segment of highlighted code into a new method. 5. .NET 4 has a new feature for keeping track of parameters that you may be passing in, you can now prepend values / variables with labels: static void Main(string[] args) { File.Copy(sourceFileName: "Myfile.txt", destFileName: "dest.txt"); }
- C# tips
- C# Tips
- C# tips
- C# Tips
- Tips-C#
- c#数据库连接小tips
- C# Tips:UInt64MaskHelper
- C#高效编程TIPS
- C# Tips: ICloneable<T>
- C#使用Tips(部分)
- C# webbrowser 使用Tips
- C# Programming tips (2) Generics
- C# Tips:位运算相关
- C# Tips:Sort a list
- C# 网络通讯乱码问题解决小tips
- ASP.NET MVC/C#开发Tips记录。
- Tips
- Tips
- 写在创业的路上:如何从无到有的打造一个产品
- RTSP协议介绍
- FlipBookCMS StudyNote-(1)
- Android ApiDemos示例解析:Graphics->Layers
- 开心
- C# tips
- GzipStream压缩解压示例
- 进销存管理系统(一)---什么是进销存管理系统
- java处理保留小数点后几位
- 在VC9.0中实现C++模板类头文件和实现文件分离的方法
- crontab问题
- windows mobile (WM)中xml文件的应用
- 能触发IE hasLayout的css属性
- PHP的流程控制