Friday, May 30, 2008

Class creating in C#

This is simple application for how to create namespace and classes in C#.After how do call them in functional class.

Step #1,

Open VSS 2005 -New->Website-> Add New Item - > add class module

If you give the file name as "DemoClass",then you will see the Class name DemoClass on your file like this,

Public DemoClass
{
If you want constructor go some codes from here..
}

Start to write below of this but under class's curly braces.
Example I create method praise

public string praise()
{
return "Praise the Lord";
}


public string praiseParameter(string s)
{

return s;
}


Now you can call this function on your different

Just initialise the class name with new operator like below
DemoClass Obj=new DemoClass();

Obj.praise();