07 2012 档案

摘要:class Program { //委托的参数个数和类型必须和委托穿的方法参数个数和类型必须保持一致 //申明委托的泛型参数 (T, U) 好处是不必关心要知道具体调用方法的参数类型 //在调用委托的时候,可以是任意类型的参数 public delegate T Del<T>( T sender ) 阅读全文
posted @ 2012-07-31 18:32 blog_yuan 阅读(221) 评论(0) 推荐(0)
摘要://泛型结构可以作为参数传给方法 int[ ] arr = { 1, 2, 3, 4, 5, 6, 7, 8 };vod Work(ArraySegment<int> seg){ ArraySegment<int> seg = new ArraySegment<int>( arr, 2, 3 ); for ( int i = seg.Offset; i < seg.Offset+seg.Count+1; i++ ) { Console.WriteLine( seg.Array[i]); }} 阅读全文
posted @ 2012-07-31 01:22 blog_yuan 阅读(250) 评论(0) 推荐(0)
摘要:public class Person { //当 lhs> rhs的时候,就进行交换位置public void SwapIfGreater<T>( ref T lhs, ref T rhs ) where T : System.IComparable<T> { T temp; if ( lhs.CompareTo( rhs ) > 0 ) { temp = lhs; lhs = rhs; rhs = temp; } } }class Program { static void Main( string[ ] args ) { Person p = new 阅读全文
posted @ 2012-07-30 17:27 blog_yuan 阅读(266) 评论(0) 推荐(0)
摘要:protected void Lbtn_Click( object sender, EventArgs e ) { string userName = this.TextUserName.Text; string userPwd = this.TextPwd.Text; userPwd = this.TextNPwd.Text; userTable = BLLuser.GetData( ); if ( userTable != null && userTable.Rows.Count >= 1 ) { if ( TextUserName.Text.Trim( ) == u 阅读全文
posted @ 2012-07-27 12:43 blog_yuan 阅读(193) 评论(0) 推荐(0)
摘要:protected void LinkButton1_Click( object sender, EventArgs e ) { string UserId = this.TextNumber.Text.Trim( ); string UserName = this.TextName.Text.Trim( ); string UserPwd = this.TextPwd.Text.Trim( ); string UserEmail = this.TextEmail.Text.Trim( ); object obj = BLLuser.GetData2( UserId );//加上select 阅读全文
posted @ 2012-07-27 12:33 blog_yuan 阅读(1428) 评论(0) 推荐(0)
摘要:class Program { static void Main( string[ ] args ) { BinarySearcharTree nums = new BinarySearcharTree( ); nums.Insert( 3 ); nums.Insert( 2 ); nums.Ins 阅读全文
posted @ 2012-07-24 01:16 blog_yuan
摘要:namespace Console运算符重载{ /// <summary> /// 这种写法类似于集成的计算方式,比较专业 /// </summary> class Class1 { public int a; public int a1; public Class1(int c, int b ) { a = c; a1 = b; } //public Class1(double cc) //{ // a1 = cc; //} //说明:implicit 关键字隐式转换指定用在将 Class 类型转换成为 int 类型,换成 explicit 就会报错 //public 阅读全文
posted @ 2012-07-13 19:12 blog_yuan 阅读(140) 评论(0) 推荐(0)
摘要:using System.Web.Caching;namespace PetShop.ICacheDependency { /// <summary> /// This is the interface that the DependencyFactory (Factory Pattern) returns. /// Developers could implement this interface to add different types of Cache Dependency to Pet Shop. /// </summary> public interfac 阅读全文
posted @ 2012-07-07 22:24 blog_yuan 阅读(146) 评论(0) 推荐(0)
摘要:<?xml version="1.0"?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"><connectionStrings><!-- SQL connection string for Profile database --><add name="SQLProfileConnString" connectionString="CONFIG_SQL_PROFILE&qu 阅读全文
posted @ 2012-07-07 22:22 blog_yuan 阅读(210) 评论(0) 推荐(0)
摘要:<%@ OutputCacheLocation="Any" 输出缓存可以位于发出请求的客户端浏览器,代理服务器,处理请求的服务器,对应于HttpCacheability.publicLocation="Client" 输出缓存位于发出请求的客户端,对应于HttpCacheability.privateLocation="Downstream" 输出缓存可以存储在任何HTTP1.1 可缓存设备中,源服务器除外,这包裹代理服务器和发出的请求的客户端。Location="server" 输出缓存可以位于处理请求的 阅读全文
posted @ 2012-07-07 22:13 blog_yuan 阅读(455) 评论(0) 推荐(0)
摘要:public static class CacheHelper{ public static System.Collections.Generic.List Products { get { HttpContext context = HttpContext.Current; List list ... 阅读全文
posted @ 2012-07-07 13:36 blog_yuan 阅读(226) 评论(0) 推荐(0)
摘要:public class CacheCD{ public static string GetMessageByCache//使用方法和属性都可以被HtmlEncode()传回去 { //HttpContext context = HttpContext.Current; get { //string message = context.Cache[ "Message" ] as string; string message = HttpRuntime.Cache[ "Message" ] as string; if ( message == null ) 阅读全文
posted @ 2012-07-06 11:54 blog_yuan 阅读(655) 评论(0) 推荐(0)
摘要:protected void BtnSace_Click( object sender, EventArgs e ) { int cellCount = int.Parse( this.TextBox1.Text ); int rowCount = int.Parse( this.TextBox2.Text ); string data = this.TextBox3.Text; for ( int i = 0; i < rowCount; i++ ) { TableRow row = new TableRow( ); Table1.Rows.Add( row ); string inp 阅读全文
posted @ 2012-07-01 18:33 blog_yuan 阅读(344) 评论(0) 推荐(0)
摘要:[WebMethod] public DataTable Show( string filename) { XmlSerializer ser = new XmlSerializer( typeof( DataTable ) ); DataTable table = new DataTable( "User" ); DataColumn col = new DataColumn( "string" ); table.Columns.Add( col ); DataRow r; for ( int i = 0; i < 10; i++ ) { r = 阅读全文
posted @ 2012-07-01 13:04 blog_yuan 阅读(2132) 评论(0) 推荐(0)