alex_bn_lee

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

随笔分类 -  Programming Related / C# Related

上一页 1 2 3

学习 C# 的一些笔记!(Visual Studio 2010,.NET Framework 4.0)
结构与类的区别
摘要:来源:http://mcdelfino.blog.51cto.com/2058744/661072不能为结构声明默认构造函数(一个无参数的构造函数).因为编译器始终会帮我们生成一个.在类中只有在没有自己写一个构造函数的前提下,编译器才 会帮我们生成一个默认构造函数.在编译器为结构生成的默认构造函数中,总是将字段设为0,false或者null,这和类是一样的.然而,在自己写的一个 构造函数中(再次提醒,这必须是一个非默认的构造函数),必须自己负责初始化所有字段,编译器不会再帮我们初始化它.这意味着必须在结构的所有非默认构造 函数中显式地初始化所有字段,否则会造成编译时错误.例如,假定把Time换 阅读全文

posted @ 2011-09-09 11:44 McDelfino 阅读(266) 评论(0) 推荐(0) 编辑

值传递与引用传递
摘要:来源:http://mcdelfino.blog.51cto.com/2058744/661036值传递, 只是传递副本, 而引用传递, 是传递一个地址~usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceConsoleApplication10{classProgram{staticvoidMain(string[]args){intv=42;intr=42;DoWorkVal(v);DoWorkRef(refr);Console.WriteLine("值传递, 阅读全文

posted @ 2011-09-09 10:43 McDelfino 阅读(167) 评论(0) 推荐(0) 编辑

string直接分成char数组
摘要:来源:http://mcdelfino.blog.51cto.com/2058744/660711string直接分成char数组, 然后逐个输出来~usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceConsoleApplication1{classProgram{staticvoidMain(string[]args){strings=Console.ReadLine();Console.WriteLine("字符----------十进制");fo 阅读全文

posted @ 2011-09-08 19:15 McDelfino 阅读(541) 评论(0) 推荐(0) 编辑

333
摘要:#region Using directivesusing System;using System.Collections.Generic;using System.Text;#endregionnamespace DailyRate{ class Program { static void Main(string[] args) { (new Program()).run(); } public void run() { double dailyRate = read... 阅读全文

posted @ 2011-09-08 17:00 McDelfino 阅读(366) 评论(0) 推荐(0) 编辑

上一页 1 2 3
点击右上角即可分享
微信分享提示