To Send an email using C# .NET
Tuesday, October 14, 2014
What is classes and method
Classes & Method in ASP.NET .
protected void Page_Load(object sender, EventArgs e)
{
//Create object of class
CommonClass objCommonClass = new CommonClass();
//Call sum function by passing 2 parameters
int intSum1 = objCommonClass.Sum(10, 20);
Response.Write("Sum1 = "+intSum1);
//Call sum function by passing 3 parameters
int intSum2 = objCommonClass.Sum(10, 20,30);
Response.Write("<br/>");
Response.Write("Sum2 = " + intSum2);
}
public class CommonClass
{
//public is access modifier
//int return type
//Sum is name of function
//x,y are the parameters
public int Sum(int x, int y)
{
return x + y;
}
public int Sum(int x, int y, int z)
{
return x + y + z;
}
}
Subscribe to:
Posts (Atom)