Thursday, March 13, 2008

Declaring Global Variables

A global variable is a variable that is accessible in every scope

New Class with Class Name: GlobalVars

public class GlobalVars
{
private static string cstmAccId;
public static string strcstmAccountId
{
get { return cstmAccId; }
set { cstmAccId = value; }
}
}

Assigning value to Global variable
GlobalVars. strcstmAccountId=”10”;

Accessing value of Global variable
String strId= GlobalVars. strcstmAccountId;

No comments: