.Net基础
文章平均质量分 63
xuqianghit
互联网门外汉
展开
-
使用DataSet读写xml
<br /><br />1. 了解DataSet加载xml文件形成的结构<br />2.读取,修改,删除xml节点实例<br />3. 一点说明及代码下载<1>. 了解DataSet加载xml文件形成的结构<br />如果是对于下面的xml文件加载进ds的话,通过vs的调试窗口,得到加载形成的ds结构如下:<?xml version="1.0" encoding="utf-8" ?><br /><bookstore><br /> <book genre="fantasy" ISBN="2-3631-4">原创 2011-04-10 09:45:00 · 608 阅读 · 0 评论 -
c#中uuid的几种形式
<br />http://msdn.microsoft.com/en-us/library/97af8hh4.aspx<br /> <br />Guid.ToString Method (String)<br />The following table shows the accepted format specifiers for the format parameter. "0" represents a digit; hyphens ("-"), braces ("{", "}"), and pare原创 2010-12-22 10:32:00 · 5047 阅读 · 0 评论 -
vs2008切换cs文件快捷键
<br />ctrl + tab<br /> <br />原创 2010-10-30 19:34:00 · 943 阅读 · 0 评论 -
C# char[] 与 string之间的转换
<br />string 转换成 Char[]<br /> string ss="abcdefg";<br /> char[] cc=ss.ToCharArray();<br /><br />Char[] 转换成string<br /> string s=new string(c);原创 2010-10-30 16:11:00 · 425 阅读 · 0 评论 -
var关键字
<br /><br />Beginning in Visual C# 3.0, variables that are declared at method scope can have an implicit type var. An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type. The原创 2010-12-19 21:56:00 · 612 阅读 · 0 评论 -
一个不错的在线画Net Diagram的网站
<br />http://www.gliffy.com/gliffy/<br /> <br />原创 2010-12-18 19:39:00 · 828 阅读 · 0 评论 -
Page.IsPostBack
<br />Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.<br /> private void Page_Load(){ if (!IsPostBack) { // Validate initially to force asterisks第一次加载原创 2010-12-16 18:24:00 · 513 阅读 · 0 评论 -
vs2010安装svn插件
vs2010安装svn插件及简单使用<br /><br /> <br />1.下载安装程序,安装<br />2.配置vs2010<br />3.check out工程<br /> 1.下载安装程序,安装<br /> 2.配置vs2010<br /> <br /><br /> <br /> <br /><br /> <br /> 3.check out工程<br />Open the project in Solution Explorer.From the File menu in Visual Studi原创 2010-12-12 15:31:00 · 7169 阅读 · 4 评论 -
xsd生成实体类相关问题
1.在xsd文件中可能存在相互嵌套的情况,这是xsd就无能无力了。 http://geekswithblogs.net/mnf/archive/2008/07/22/generate-c-class-from-xsd-file.aspx > Generate C# class from XSD file. I have an existing C# file, generated a long time ago from XSD definition. The XSD files were cha原创 2010-08-27 16:39:00 · 2643 阅读 · 1 评论 -
How to: Implement Interface Events
<br />An interface can declare an event. The following example shows how to implement interface events in a class. Basically the rules are the same as when implementing any interface method or property.<br /> To implement interface events in a class<br />D原创 2010-06-12 16:26:00 · 427 阅读 · 0 评论 -
A problem has been encountered while loading the setup components. Canceling setup
Do not repair VS 2008 SP1 from installation media<br />If you need to repair Visual Studio 2008 once SP1 has been applied or wish to change which features are installed, you cannot run setup.exe from the original installation media.<br />When you run repai原创 2010-08-01 16:33:00 · 939 阅读 · 0 评论 -
vs2010 fomat selection code
<br />ctrl + A, ctrl + E, F,自动格式化代码。原创 2010-07-28 15:56:00 · 423 阅读 · 0 评论 -
Delegate & Event
<br />A delegate is a reference type, like the other reference types you've seen in this book, but instead of referring to an object, a delegate refers to a method. This is called encapsulating the method. When you create the delegate, you specify a method原创 2010-07-29 14:40:00 · 374 阅读 · 0 评论 -
Converting VS2010 Solution to VS2008,将vs2010工程转换成vs2008
If you are working with VS 2010 (any Edition) and cannot open your 2010 solution on VS 2008 then just follow these 3 Steps:For .sln:1. Open the solution file in your favorite text editor (ex: notepad++).2. Find the Following:Microsoft Visual Studio Solutio原创 2010-07-26 21:39:00 · 1697 阅读 · 2 评论 -
设计模式学习17 Chain Of Responsibility
应用场景:<br /> <br /> Chain the receiving objects and pass the request along the chain until an object handles it. <br /> 实现代码:<br /> <br /> class Request { } abstract class BaseHandler { public BaseHandler(BaseHandler next)原创 2010-07-23 20:47:00 · 510 阅读 · 0 评论 -
设计模式学习21 State
应用场景:<br /> <br />在软件的构建过程中,对象的状态改变之后,对象的行为也会随之改变,如何在运行时根据对象的状态透明的更改对象的行为就是state模式解决的问题。<br /> 实现代码:<br /> <br /> // 抽象类,表达状态的依赖状态行为 abstract class StateDocument { public abstract void Handler1(); public abstract void Handler2()原创 2010-07-24 20:13:00 · 537 阅读 · 0 评论 -
c#解惑 c#中的值和引用
<br />c#中的值和引用<br /> <br />1.c#中的值和引用类型<br />2.传递参数ref<br /> <br /><br />1.c#中的值和引用类型<br /> <br /><br /> <br /><br /> <br />2.参数传递ref<br /> <br />如果函数中想要改变传递的参数(值类型的)的内部数据的话,可以使用关键字ref。需要注意的是关键字ref可以作为函数重载时函数签名的一部分。<br /> <br /> <br /> <br />原创 2010-11-03 14:22:00 · 404 阅读 · 0 评论 -
c#解惑
c#解惑系列1.c#中的值和引用2.预处理3.各种访问修饰符4.对象销毁5.多态6.操作符重载7.接口8.is or as?9.params关键字10.不规则数组11.委托和事件12.程序集和版本控制13.属性和反射14.线程15.序列化16.独立存储空间17.com组件编程原创 2010-11-03 13:43:00 · 418 阅读 · 0 评论 -
goto switch case应用
<br />switch(MyVariable){ case1: //statements …........ if ( expression ) gotocase3: break; case2: ….. break; case3: …...... break;}<br />原创 2011-02-18 14:55:00 · 813 阅读 · 0 评论 -
c#中结构体structure初始化
<br />1. c# structure基本事实<br />2. 初始化问题<br />3. 总结<br /> <br /> <br />1. c# structure基本事实<br /> <br />c# structure为值类型,和class是相类似,但是c#中的class是引用类型。<br /> <br /> <br />2. 初始化问题<br /> <br />下面是两段代码,看上去是相似的,但是其中一段代码是不能够编译的:<br />public struct StructMember{原创 2011-02-18 14:52:00 · 12726 阅读 · 0 评论 -
Lambda表达式
<br /><br /> <br />参考文章:<br /> <br />http://msdn.microsoft.com/en-us/library/bb397687.aspx<br />http://msdn.microsoft.com/en-us/library/orm-9780596516109-03-09.aspx<br /> <br />未完,待续...原创 2011-01-28 19:55:00 · 442 阅读 · 0 评论 -
default关键字
1.使用情景2.参考文章及测试代码下载1. 使用情景default关键字主要是用于解决在泛型编程中变量初始化的问题,如何给类型为T的变量附一个默认值?这里就用到了default关键字,下面的示例使用的int做的测试: // default主要是用于泛型编程,这里仅仅是简单的测试 int defaultIntValue = default(int); Console.WriteLine(defaultIntValue);下面这个示例是d原创 2011-01-28 19:20:00 · 642 阅读 · 0 评论 -
c#中的??
<br />1.使用场景<br />2.参考文章及示例代码下载<br />1. 使用场景<br /> <br />msdn:It returns the left-hand operand if it is not null; otherwise it returns the right operand.如果左侧值不为空的话,返回左侧的值,否则返回右面的值,下面是一个测试示例:<br /><br />class NullCoalesce{ static int? GetNullableInt(原创 2011-01-28 19:47:00 · 516 阅读 · 0 评论 -
.net多线程学习笔记 2 thread生命周期
thread生命周期简介在msdn上http://msdn.microsoft.com/en-us/library/system.threading.threadstate.aspx对于线程的生命周期总结如下:StateDescriptionRunningThe thread has been started, it is not blocked, and there is no pending ThreadAbortException.StopRequestedThe thread is being re原创 2011-01-24 15:46:00 · 1254 阅读 · 0 评论 -
.net多线程学习笔记1
1.什么是process和thread?2.什么是appdomain?3.什么是thread local storage?4.在.net framework中如何启动一个进程?5.thread优先级6.callbacks回调7.参考资料和实验代码下载1.了解.net framework下的process和threadwindows下通过启动任务管理器能够看到当前计算中正在运行的application应用程序的列表,如下图所示:下图中显示了当前计算机中所有的进程信息:上面的图片展示了下面一个事实,appli原创 2011-01-22 22:26:00 · 677 阅读 · 0 评论 -
.net多线程学习笔记 3 线程间同步
线程间同步<br /><br /> <br /> <br />未完,待续。。。原创 2011-01-25 15:54:00 · 413 阅读 · 0 评论 -
as和is关键字
<br />1.as关键字<br />2.is关键字<br />3.参考资料和代码下载<br />1.as关键字<br /> <br />使用as关键字的表达式的一般情景是:obj as type,该表达式返回的是type指定的类型或者是null。简单的测试代码如下:<br /> <br /> class AsTest { public static void DoTest() { string obj1 = "as1";原创 2011-01-22 21:10:00 · 1281 阅读 · 0 评论 -
序列化
序列化<br /> <br /><br /> <br />1.什么是“序列化”?<br />2.简单序列化实例?<br /> <br />1.什么是“序列化”?<br /> <br />http://msdn.microsoft.com/en-us/library/7ay27kt9(v=VS.71).aspx<br /> <br />Serialization is the process of converting the state of an object into a form that can b原创 2011-01-02 16:30:00 · 452 阅读 · 0 评论 -
string = alias(String)
<br />1.String和string再c#中的有什么不同?<br />2.datatype alias<br /> <br /><br /> <br />1.String和string再c#中的有什么不同?<br /> <br /><br />As others have noted, string is an alias for System.String. They compile to the same code, so at execution time there is no differ原创 2011-01-04 21:11:00 · 665 阅读 · 0 评论 -
FileDialog简单使用demo
<br />private void button1_Click(object sender, System.EventArgs e){ Stream myStream = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c://" ; openFileDialog1.Filter = "txt files (*.t原创 2011-01-04 11:07:00 · 563 阅读 · 0 评论 -
一个简单的音乐播放器
<br />wpf + irrKlang :源码下载地址原创 2011-01-04 10:57:00 · 521 阅读 · 0 评论 -
c#解惑 各种访问修饰符
<br />c#的各种访问修饰符<br /> <br /> <br /> <br /> <br />1.各种访问修饰符<br />2.程序集?<br /> <br /> <br /> <br /> <br />1.各种访问修饰符<br /> 访问修饰符说明public公有访问。不受任何限制。private私有访问。只限于本类成员访问,子类,实例都不能访问。protected保护访问。只限于本类和子类访问,实例不能访问。internal内部访问。只限于本项目内访问,其他不能访问。protected inter原创 2010-11-03 15:44:00 · 527 阅读 · 0 评论 -
c#解惑 预处理
<br />c#解惑 预处理<br /> <br />1.#define<br />2.#if, #else, #elif, #endif<br />3.#undef<br />4.#region<br /> <br /><br /> <br />C#中的预处理指令只是实现了c++中的一个子集,关键字的使用是和c++中是相同的。需要注意在cs文件中#define和#undef需要在文件的开始处声明。<br /> <br />下面是一个主要框架:<br /> <br />// 预处理指令<br />#defi原创 2010-11-03 14:40:00 · 367 阅读 · 0 评论 -
设计模式学习22 总结
整个设计模式的学习是通过msdn webcast来进行的,首先感谢“李建忠”老师辛勤的讲解(这个视频教程的时间可能是比较老的,好像是05年东西),但是通过整个教程的学习,感觉还是收获很多,对于面向对象有了更深的理解。下面是整个设计模式的总结: Creational Patterns Abstract Factory Creates an instance of several families of classes,解决的多系列对象创建问题。 Builder Separates object co原创 2010-07-24 20:53:00 · 836 阅读 · 0 评论 -
设计模式学习20 Strategy
应用场景:<br /> <br />在软件的构建过程中,某些对象使用的算法可能多种多样,如果将这些算法直接编码到使用的类中的,这些类的维护旧就成为一个问题。解决的思路是“封装变化点”,将算法首先抽象出一个父类,然后在使用这些算法的类中只保留父类的引用,而传递的就是具体类。<br /> 实现代码:<br /> <br /> class Program { static void Main(string[] args) { // 这里动态改原创 2010-07-24 19:58:00 · 491 阅读 · 0 评论 -
设计模式学习5 Prototype
<br />应用场景: <br />复杂对象构建,这些对象是可能不断变化的,但是这些对象的借口是相对稳定的。<br /> <br />实现代码:<br /> public interface INormalActor { INormalActor Clone(); } public interface IFlyActor { IFlyActor Clone(); } public interface IW原创 2010-07-20 16:06:00 · 433 阅读 · 0 评论 -
设计模式学习1 Singleton
Design Pattern : Singleton 1.闲话:不是为了使用设计模式而学习设计模式,设计模式是在实际项目中根据常见的问题而总结出来的正确的做法。实际项目中,用户的需求是在不断变化,而设计模式的使用就是为了应对这种变化,尽量更改较少的代码来应对需求的变化。2.面向对象设计原则针对接口编程有先使用对象组合,尽量较少使用对象组合封装变化点,应对实际中需求变化3.Singleton Pattern // 实现传递参数singleton,如何控制用户使用new对共有对象的调用。 public原创 2010-07-19 18:48:00 · 572 阅读 · 0 评论 -
Reflection in .net
<br /><br /><br />最近在看设计模式的一些东西,在讲到builder模式中使用到了c#的反射机制,从网上找了写资料,整理如下:<br /> <br />在C#中,我们要使用反射,首先要搞清楚以下命名空间中几个类的关系: <br /> System.Reflection命名空间<br />(1) AppDomain:应用程序域,可以将其理解为一组程序集的逻辑容器<br />(2) Assembly:程序集类<br />(3) Module:模块类<br />(4) Type:使用反射得转载 2010-07-20 13:03:00 · 433 阅读 · 0 评论 -
设计模式学习3 Builder Pattern
应用场景:在软件系统中,有时面临着“一个复杂对象的创建”的工作,通常是由各个部分的是使用一定的算法来过程的。由于需求的变化(各个部分在变化),每个部分经常面临巨大的变化,但是将他们组合在一起的算法确实相对稳定的。同样的构建过程可以创建不同的表示。 实现代码:interfaces: // 这里是相当于能够提供的服务,客户端只需要使用这些接口皆可以了。 public interface IBuilder { void BuildDoor(); void B原创 2010-07-20 10:40:00 · 549 阅读 · 0 评论 -
c# ProgressBar
1.使用PictureBox加载一个gif图像,这样的好处是可以避免winform中的线程的困扰。下面就是这个所使用的图片资源。比较容易。如果想要使用progress bar的话,直接设置PictureBox的visible属性http://cid-f41b44b9285d0b86.spaces.live.com/blog/cns!F41B44B9285D0B86!298.entry中原创 2010-03-29 19:17:00 · 2234 阅读 · 0 评论