随笔分类 - 00.Net
摘要:一维数组一维数组以线性方式存储固定数目的项,只需一个索引值即可标识任意一个项。在 C# 中,数组声明中的方括号必须跟在数据类型后面,且不能放在变量名称之后,而这在 Java 中是允许的。因此,类型为 integers 的数组应使用以下语法声明:int[] arr1;下面的声明在 C# 中无效://int arr2[]; //compile error声明数组后,可以使用 new 关键字设置其大小,这一点与 Java 相同。下面的代码声明数组引用:int[] arr;arr = new int[5]; // create a 5 element integer array然后,可以使用与 Jav
阅读全文
摘要:AppendersThe ability to selectively enable or disable logging requests based on their logger is only part of the picture. Log4net allows logging requests to print to multiple destinations. In log4net speak, an output destination is called an appender. Appenders must implement the log4net.Appenders.I
阅读全文
摘要:from: http://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext(v=vs.103).aspxDbContextwrapsObjectContextand exposes the most commonly used features ofObjectContextby using simplified and more intuitive APIs. You can access the underlyingObjectContextwhenever you need to use features that
阅读全文
摘要:Parse (Database Engine)Parse converts the canonical string representation of ahierarchyidto ahierarchyidvalue.Parseis called implicitly when a conversion from a string type tohierarchyidoccurs. Acts as the opposite ofToString.Parse()is a static method.Syntax-- Transact-SQL syntaxhierarchyid::Parse (
阅读全文
摘要:/*****************************************************///Create Class With Interface Dependencies#region//需要某实现某接口的具体实例UnityContainer container=new UnityContainer();container.RegisterType(ILogger,NullLogger>();Database datavase = container.Resolve<CustomDatabase>Database();#endregionCustomD
阅读全文
摘要:Reflection Examples [C#]This example shows how to dynamically load assembly, how to create object instance, how to invoke method or how to get and set propertyvalue.Create instance from assembly that is in your project ReferencesThe following examples create instances of DateTime class from the Syst
阅读全文
摘要:http://martinfowler.com/articles/injection.htmlInversion of ControlWhen these containers talk about how they are so useful because they implement "Inversion of Control" I end up very puzzled.Inversion of controlis a common characteristic of frameworks, so saying that these lightweight cont
阅读全文
摘要:<!--Timeout: 180 minutes--><system.web> ... <sessionState cookieless="true" timeout="180" stateConnectionString="tcpip=127.0.0.1:42424" mode="StateServer" /> ... </system.web> 若允许远程机器访问本机的ASP.NET State Service修改注册表:Windows Registry Edit
阅读全文
摘要:http://msdn.microsoft.com/en-us/vcsharp/aa336746Restriction OperatorsWhere - Simple 1Where - Simple 2Where - Simple 3Where - DrilldownWhere - IndexedProjection OperatorsSelect - Simple 1Select - Simple 2Select - TransformationSelect - Anonymous Types 1Select - Anonymous Types 2Select - Anonymous Typ
阅读全文
摘要:Each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one t
阅读全文
摘要:from:http://www.haskell.org/haskellwiki/Haskell_in_5_steps#Write_your_first_parallel_Haskell_program起由: Write your first parallel Haskell programHaskell has good support for parallel and multicore programming. We can write a parallel program by adding `par` to expressions, like so:import Control.Par
阅读全文
摘要:http://www.intrepidstudios.com/blog/2010/7/11/debug-your-net-web-project-with-iis-express-t.aspxUpdate:IIS Express has beenofficially releasedas a standalone installation.For those of us too impatient to wait for Visual Studio SP1 to natively support IIS Express, I've done some digging and found
阅读全文
摘要:using System;using System.Linq;using System.Text;namespace DesignPatterns.Mediator{ //MediatorR abstract class AbstractChatroom { public abstract void Register(Participant participant); public abstract void Send(string from, string to, string message); } //ConcreteMediat...
阅读全文
摘要:http://madskristensen.net/post/A-NET-resource-editor-application-for-resx-files.aspxhttp://resourceeditor.codeplex.com/download: http://files.cnblogs.com/wucg/ResourceEditor.zip
阅读全文
摘要:http://stackoverflow.com/questions/4591638/spring-net-ref-to-dictionary-item<object name="Paths" id="Paths" type="System.Collections.Generic.Dictionary<string,string>"> <constructor-arg> <dictionary key-type="string" value-type=&qu
阅读全文
摘要:1.Web.config:<appSettings> <add key="log4net.Internal.Debug" value="true"/></appSettings> 2.log4net_config_file.xml<appender name="DebugAppender" type="log4net.Appender.DebugAppender, log4net" > <layout type="log4net.Layout.Patt
阅读全文
摘要:最简单的方法在项目根目录与.git目录同一位置创建一个文件: .gitignoretouch .gitignorevi .gitignore:wq注:如果要忽略的文件已被git管理,需要先移除,命令如下:e.g.:git rm -r --cached WebRoot/WEB-INF/classes/**/*-r:递归git commit然后.gitignore中的忽略,起作用以下参考//-------------------from:http://gitready.com/beginner/2009/01/19/ignoring-files.htmlThe easiest and simple
阅读全文
摘要:connection.BeginTransaction()此方法的事务,不能嵌套。Error:Message "SqlConnection 不支持并行事务。" string可以使用TransactionScope:需要使用windows的Distributed Transaction Coordinator (分布式事务协调器)服务。//Main.csusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;usi
阅读全文