How to add log4net in your .Net project?

Steps to add log4net in your .net project?


ADDING DLL
Just place the 'log4net.dll' in your project folder
In Solution Explorer, Right click on the 'References' Folder
and click 'Add References'
Now choose the log4net.dll under the BROWSE tab

ADDITION in WEB.CONFIG/APP.CONFIG
Add the following xml thing in your config file, under element

    

ADDITION in ASSEMBLYINFO.cs

In Solution Explorer, under Properties folder, you can find the AssemblyInfo.cs
Just open it & Add the following @ very last line

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

ADDING SOURCE CODE
Now coding part,

Just add the following namespace in your .cs file,

using log4net;
using log4net.Config;

Initialize the below statement in your method

private static log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Inside your method, Start logging

logger.Info(" ** GoogleDotnet.Blogspot.com - Logging Begins ** ");

Tats it..

Happy Coding

Add two lists in C#

Add two lists / Combine lists in C#


var result = list1.Concat(list2);
ListaddedList = result.ToList();


Here you go wit an example

List list1 = new List();
list1.Add("One");
list1.Add("Two");

List list2 = new List();
list2.Add("three");
list2.Add("four");

var result = list1.Concat(list2);
List addedList = result.ToList();
(Now addedList = list1 + list2 )

Keep ur coding aside.. Relax for some time..