艾榕@编程的乐趣 享受编程,享受生活

25二/100

在.NET项目中使用log4net

log4net是Apache开发的一个用于.NET应用程序的logger工具,log4net是开源的,使用Apache License, Version 2.0开源协议。 Read more...

7二/105

使用InternalsVisibleTo给assembly添加“友元assembly”

C#的internal关键字可以使标记的方法,字段或者属性等等只能在当前assembly内部使用,那么如果其他的assembly需要使用这个internal的方法的时候怎么办呢?.NET提供了一种类似于C++中的友元类的方式来完成这个功能,那就是使用InternalsVisibleTo Read more...

7十二/090

How to use Sql Azure

Description:
Sql Azure is the cloud computing service provided by Microsoft, which is @CTP version now.  Sql Azure will provide you databases on the cloud level, this means you can host your data on the MS’s database server, definitely, it will be more safety.
Apply for an Sql Azure account:
Even Sql Azure is @CTP, but your still need to use a activation code to get an Azure account,  go to https://sql.azure.com and apply for an account, you will probably get your activation code after several hours.
Create an databaseGo to https://sql.azure.com and login with your username, click on the “Create Database”  button to create a new database, in this document, I will use the “FirstTestDb”  as my demo database name.
Connect to Sql Azure from the command lineBefore connect to Sql Azure, you need to get the following from your Sql Azure portal page:
Server: which is of format ****.database.windows.netServerName: which is the first part of the Server.
Username: the administrator name when your active your Sql Azure account.
Password: the password when you active your Sql Azure account.
For example: my server is fx50bskenx.database.windows.net, so my server name is fx50bskenx,  my username is wlmzfxType sqlcmd -S fx50bskenx.database.windows.net -U wlmzfx@fx50bskenx -d FirstTestDb at your command line, and then type your password, once you see the 1> from your command window, that means you have connected to Sql Azure successfully.
Note: Sql Azure does not support USE databasename command for the moment, so you need to specify your database when typing the command.
Execute Sql command against Sql AzureCreate a new table Person:
1> CREATE TABLE Person (Id INT IDENTITY(0,1) PRIMARY KEY, FirstNameNVARCHAR(50))2> GOInsert a new row to the Person table:
1> INSERT INTO Person (FirstName) VALUES(N'Wang Pan');2> GONote: type one more GO at a new line at the end of your command, I have tried to use ; to specified end of and command, but it does not work.

Description:

Sql Azure is the cloud computing service provided by Microsoft, which is @CTP version now.  Sql Azure will provide you databases on the cloud level, this means you can host your data on the MS’s database server, definitely, it will be more safety. Read more...

7十二/090

性能: 字符串倒序算法 (C# version)

C#中有个string类型,是个很特殊的reference type, 存储在内存中一个特殊的“静态池”中,这里是MSDN关于string的介绍:http://msdn.microsoft.com/zh-cn/library/362314fe(VS.80).aspx Read more...

24七/090

Update the application configuration file automatically in C#

The structure of an application’s configuration file always include: Read more...

9十一/080

DotNet下NUnit的使用(2)—- 第一个NUnit工程

DotNet下NUnit的使用(2)---- 第一个NUnit工程 收藏
准备工作
1. 打开visual studio, 新建一个“Class Library”工程,命名为“NUnitDemo”
2. 在工程中新建一个Class:“FirstNUnitClass”, 在类中添加一个public的方法:GetBonous(int level), 最终类的内容:

准备工作
1. 打开visual studio, 新建一个“Class Library”工程,命名为“NUnitDemo”
2. 在工程中新建一个Class:“FirstNUnitClass”, 在类中添加一个public的方法:GetBonous(int level), 最终类的内容: Read more...

9十一/080

DotNet下NUnit的使用(1)—- NUnit入门

  • 什么是Nunit
    NUnit 是一个单元测试框架,可以用于所有的.Net语言,与JUnit类似,可以用来很方便的进行单元测试,NUnit是完全用C#语言编写而成,使用NUnit,您可以只需在您的代码上加上简单的'Attribute'就可以进行单元测试,目前NUnit的最新稳定版本是 2.4.8 (下载 ), 下面是来自就NUnit官方的介绍:

    NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit, the current production release, version 2.4, is the fifth major release of this xUnit based unit testing tool for Microsoft .NET. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages.
    Read more...