Archive for March, 2007

How to add modules in assembly?

Posted in C# 2.0 on March 29, 2007 by bimal4u

csc /addmodule:firstmodule.netmodule;secondmodule.netmodule /out:main.exe main.cs
This will compile source file main.cs and add metadata from firstmodule.netmodule and secondmodule.netmodule to produce main.exe

Can ASP and ASP.NET apps run on the same server ?

Posted in .net 1.0 on March 29, 2007 by bimal4u

– Yes. They will run side-by-side with no adverse affects to the ASP pages at all.
– You can easily use ASP and ASP.NET code running in parallel on the same web site. 

– ASP.NET files use a .aspx extension while classic ASP uses a .asp extension, allowing classic ASP and ASP.NET code to run happily on the same web site and same web site too.
– ASP and related file extensions are handled by asp.dll. all ASP related functionalities are contained by ISAPI dll called asp.dll. ASP.NET related file extensions are handled by aspnet_isapi.dll. All functionalities of ASP.NET contained by ISAPI dll called aspnet_isapi.dll.
– So when any request comes to IIS, it recognizes the file extension and simply redirects that request to the relevant handler (ISAPI dll) and rest will be done by handler.

DataKey Binding in C#

Posted in C# 2.0 on March 28, 2007 by bimal4u

C# 2.0 Datakey binding

Alphanumeric Sorting

Posted in Net 2.0 on March 28, 2007 by bimal4u

Download : String Logical Comparer file 

Sorting for ArrayList :

1) Here blnAscSort is local boolean variable. If you want to data is in ascending/Descending order you can set through this variable.

if (blnAscSort)  Sorting.isDesSort = false;

else  Sorting.isDesSort = true;

//And call the sort method of override StringLogicalComparer.cs file

coll.Sort(Sorting.Default);

———————————–

Sorting for ListArray :

if (blnAscSort)  Sorting.isDesSort = false;

else  Sorting.isDesSort = true;

//And call the sort method of override StringLogicalComparer.cs file

coll.Sort(Sorting.ListData); 

//Only diff is In ListArray u called (Sorting.ListData) method.

Unique sorting (1, 1, 5, 5, 5, 9, 3, 3, 3, 9, 9, 9)

Posted in Net 2.0 on March 28, 2007 by bimal4u

int[] DataArray = { 1, 1, 5, 5, 5, 9, 3, 3, 3, 9, 9, 9 };

int[] SortedUniqueData= MakeUnique(xs); 

static T[] MakeUnique<T>(T[] values)

{

System.Collections.Generic.Dictionary<T, bool> dict ;

dict= new System.Collections.Generic.Dictionary<T, bool>();

foreach (T value in values)

if (!dict.ContainsKey(value)) dict.Add(value, false);

return new List<T>(dict.Keys).ToArray();

}

——————————————- Or other Solution is for GenericList object:

Decalre only ‘curVal’ variable is global

int curVal = 0;

List<int> lst = new List<int>();

List<int> newLSt = lst.FindAll(ISUnique);

public bool ISUnique(int PrevVal)

{

if (curVal != PrevVal)

{  curVal = PrevVal; return true; }return false;

}