随笔分类 -  Basic .Net

摘要:.net的类库中提供了List类型和LinkedList类型,那么什么情况下使用List,何时使用LinkList?基本上说这两者的使用情况和数据结构中链表(LinkedList)和数组(List),LinkedLis对于插入和删除的效率是比较高的,但是如果是经常性的需要随机访问数组成员的话,最好是使用List类型。参考这里:http://stackoverflow.com/questions/169973/when-should-i-use-a-list-vs-a-linkedlist 阅读全文
posted @ 2011-05-12 10:21 qiang.xu 阅读(520) 评论(0) 推荐(0) 编辑
摘要:1. 了解DataSet加载xml文件形成的结构2.读取,修改,删除xml节点实例3. 一点说明及代码下载<1>. 了解DataSet加载xml文件形成的结构如果是对于下面的xml文件加载进ds的话,通过vs的调试窗口,得到加载形成的ds结构如下:<?xmlversion="1.0"encoding="utf-8"?><bookstore><bookgenre="fantasy"ISBN="2-3631-4"><title>Oberon'sLega 阅读全文
posted @ 2011-04-10 09:36 qiang.xu 阅读(10123) 评论(2) 推荐(2) 编辑
摘要:1. 代码示例2. 注意事项1. 代码示例using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace SortTest{ class Program { static void Main(string[] args) { List<Person> people = new List<Person>(); people.Add(new Person(50, "Fred")); people.Add(new Person(30, & 阅读全文
posted @ 2011-03-30 16:29 qiang.xu 阅读(2316) 评论(0) 推荐(0) 编辑
摘要:1. 数组声明2. 数组初始化3. 数组取值1. 数组声明int[] table; // not int table[]; int[] numbers; // declare numbers as an int array of any size numbers = new int[10]; // numbers is a 10-element array numbers = new int[20]; // now it's a 20-element arraystring[,] names = new string[5,4];2. 数组初始化int[] numbers = new i 阅读全文
posted @ 2011-03-16 10:45 qiang.xu 阅读(228) 评论(0) 推荐(0) 编辑
摘要:1.了解MEF2. 简单的demo3. 代码下载1. 了解MEFmef是codeplex上的开源项目,地址:http://mef.codeplex.com/,工程目的:simplifying the design of extensible applications and components.2. 简单demo2.1 新建asp.net web application,添加System.ComponentModel.Composition的应用。2.2 添加一个web form页面aspnetMEFBasic.aspx,后台代码如下:usingSystem;usingSystem.Coll 阅读全文
posted @ 2011-03-12 16:38 qiang.xu 阅读(1263) 评论(7) 推荐(0) 编辑
摘要:NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio. 阅读全文
posted @ 2011-03-12 15:53 qiang.xu 阅读(424) 评论(0) 推荐(0) 编辑
摘要:需要注意的是如果想要通过代理邮件服务器(上图中的gmail,hotmail等)来发送邮件的话,那么个有邮件服务器上需要开启smtp服务,默认的情况下163是开启的,但是qq默认是关闭的。需要开启之后才能使用。/Files/xuqiang/SendingEmailFromClients.zip 阅读全文
posted @ 2011-03-12 15:24 qiang.xu 阅读(1075) 评论(1) 推荐(0) 编辑
摘要:1. Lambda的Hello World2. Lambda表达式3.Lambda代码块4. 不确定参数的Lambda表达式5.Lambda表达式中变量作用域6. 参考资料7. 代码下载1.Lambda的Hello Worlddelegate int del(int i);// delegate hello worlddel myDelegate = x => x * x;int j = myDelegate(10);上面代码首先声明一个代理del,然后在对del进行赋值是采用的是Lambda表达式的形式,通过赋值,del就能够表示输入x,返回x的平凡。2. Lambda表达式简单的将L 阅读全文
posted @ 2011-01-28 19:55 qiang.xu 阅读(327) 评论(0) 推荐(0) 编辑
摘要:1.使用场景2.参考文章及示例代码下载1. 使用场景msdn:It returns the left-hand operand if it is not null; otherwise it returns the right operand.如果左侧值不为空的话,返回左侧的值,否则返回右面的值,下面是一个测试示例:classNullCoalesce{staticint?GetNullableInt(){returnnull;}staticstringGetStringValue(){returnnull;}staticvoidMain(){//??operatorexample.int?x= 阅读全文
posted @ 2011-01-28 19:47 qiang.xu 阅读(172) 评论(0) 推荐(0) 编辑
摘要:1.使用情景2.参考文章及测试代码下载1. 使用情景default关键字主要是用于解决在泛型编程中变量初始化的问题,如何给类型为T的变量附一个默认值?这里就用到了default关键字,下面的示例使用的int做的测试: // default主要是用于泛型编程,这里仅仅是简单的测试 int defaultIntValue = default(int); Console.WriteLine(defaultIntValue); 下面这个示例是default关键字的相当于小技巧的例子:使用default关键字判定一个类型是否是引用或者是值类型。 class Program { static void M 阅读全文
posted @ 2011-01-28 19:20 qiang.xu 阅读(808) 评论(0) 推荐(0) 编辑
摘要:线程间同步未完,待续。。。 阅读全文
posted @ 2011-01-25 15:54 qiang.xu 阅读(248) 评论(0) 推荐(0) 编辑
摘要:1.as关键字2.is关键字3.参考资料和代码下载1.as关键字使用as关键字的表达式的一般情景是:obj as type,该表达式返回的是type指定的类型或者是null。简单的测试代码如下:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--classAsTest{publicstaticvoidDoTest(){stringobj1="as1";objectobj2="as2";stringobj3=obj2asstring;if(obj3! 阅读全文
posted @ 2011-01-22 21:10 qiang.xu 阅读(278) 评论(0) 推荐(0) 编辑
摘要:1.String和string再c#中的有什么不同?2.datatype alias1.String和string再c#中的有什么不同?As others have noted,stringis an alias forSystem.String. They compile to the same code, so at execution time there is no difference whatsoever. This is just one of the aliases in C#. The complete list is:object: System.Objectstring: 阅读全文
posted @ 2011-01-04 21:11 qiang.xu 阅读(426) 评论(0) 推荐(0) 编辑
摘要:private void button1_Click(object sender, System.EventArgs e){ Stream myStream = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\" ; openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ; openFileDialog1.Filte 阅读全文
posted @ 2011-01-04 11:07 qiang.xu 阅读(600) 评论(0) 推荐(0) 编辑
摘要:wpf + irrKlang :源码下载地址 阅读全文
posted @ 2011-01-04 10:57 qiang.xu 阅读(202) 评论(0) 推荐(0) 编辑
摘要:序列化1.什么是&ldquo;序列化&rdquo;?2.简单序列化实例?1.什么是&ldquo;序列化&rdquo;?http://msdn.microsoft.com/en-us/library/7ay27kt9(v=VS.71).aspxSerialization is the process of converting the state of an object into a form that can be persisted or transported. The complement of serialization is deserializat 阅读全文
posted @ 2011-01-02 16:30 qiang.xu 阅读(267) 评论(0) 推荐(0) 编辑
摘要:http://msdn.microsoft.com/en-us/library/97af8hh4.aspxGuid.ToString Method (String)The following table shows the accepted format specifiers for the format parameter. "0" represents a digit; hyphens ("-"), braces ("{", "}"), and parentheses ("(", " 阅读全文
posted @ 2010-12-22 10:32 qiang.xu 阅读(12728) 评论(0) 推荐(0) 编辑
摘要:Beginning in Visual C# 3.0, variables that are declared at method scope can have an implicit typevar. An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type. The following two declarations ofiare functionally equivalen 阅读全文
posted @ 2010-12-19 21:56 qiang.xu 阅读(281) 评论(0) 推荐(0) 编辑
摘要:http://www.gliffy.com/gliffy/ 阅读全文
posted @ 2010-12-18 19:39 qiang.xu 阅读(334) 评论(0) 推荐(0) 编辑
摘要:Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.private void Page_Load(){ if (!IsPostBack) { // Validate initially to force asterisks第一次加载 // to appear before the first roundtrip. Validate(); }} 阅读全文
posted @ 2010-12-16 18:24 qiang.xu 阅读(139) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示