随笔分类 -  CSharp

some code
摘要:Stream s = new MemoryStream(); StreamWriter w = new StreamWriter(s); w.WriteLine("!"); w.Flush(); //w.Close(); StreamReader r = new StreamReader(s); Console.WriteLine(s.Length); s.Position = 0; Consol... 阅读全文
posted @ 2012-02-03 10:33 木由水 阅读(319) 评论(0) 推荐(0)
摘要:1 System.IO.TextWriter old = System.Console.Out; //备份原来的stream 2 using (System.IO.TextWriter w = System.IO.File.CreateText("log.txt")) 3 { 4 System.Console.SetOut(w); 5 System.Console.WriteLine("123"); 6 } 7 8 System.Console.SetOut(old); 9 10 System.Diagnostics.Process.Start(&quo 阅读全文
posted @ 2011-04-20 23:44 木由水 阅读(245) 评论(0) 推荐(0)
摘要:通常我们在程序中需要调用WebService时,都是通过"添加Web引用",让 VS.NET环境来为我们生成服务代理,然后调用对应的Web服务。这样是使工作简单了,但是却和提供Web服务的URL、方法名、参数绑定在一起了,这是VS.NET自动为我们生成Web服务代理的限制。如果哪一天发布Web服务的URL改变了,则我们需要重新让VS.NET生成代理,并重新编译。在某些情况下,这... 阅读全文
posted @ 2011-02-10 15:56 木由水 阅读(220) 评论(0) 推荐(0)
摘要:理解POCO(Plain Old CLR Object)先要理解POJO。   1、什么是POJO?   POJO的名称有多种,pure old java object 、plain ordinary java object 等。   按照Martin Fowler的解释是"Plain Old Java Object",从字面上翻译为"纯洁老式的java对象",但大家都使用"简单java对象"来... 阅读全文
posted @ 2011-01-26 09:33 木由水 阅读(647) 评论(1) 推荐(1)
摘要:1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=... 阅读全文
posted @ 2010-11-13 20:59 木由水 阅读(131) 评论(0) 推荐(0)
摘要:using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Text;using System.Collections.Generic;using System.Diagnostics;///<summary>/// DBHelper 的摘要说明///</summary>namespace DAL{ publicstaticclass DBHelper { privatestatic SqlConnection conn; //定.. 阅读全文
posted @ 2010-06-04 17:17 木由水 阅读(513) 评论(0) 推荐(0)
摘要:大数运算Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1usingSystem;2usingSystem.Numerics;34namespaceConsoleApplication15{6classProgram7{8staticvoidMain(... 阅读全文
posted @ 2010-04-20 20:40 木由水 阅读(245) 评论(0) 推荐(0)
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceConsoleApplic... 阅读全文
posted @ 2010-02-28 23:52 木由水 阅读(300) 评论(0) 推荐(0)