Author: craigbtx | Posted on: 2/7/2010 2:09:15 PM | Views : 283

 I am new to C# for developing web apps.
How do I create a variable whose value is accessible in all methods?
Also is this line correct where the value is across all instances of this class?
static int intNumber_All_Instances_Of_Class = 100; //all instances of this class scope
Thanks
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for TestClass
/// </summary>

public class TestClass
{
    int intNumber_Instance_Of_This_Class = 10; //this instance of this class scope

    static int intNumber_All_Instances_Of_Class = 100; //all instances of this class scope

    public static int intNumber_Global = 110; //global scope
 
    public static int ScopeOfVariable() //callable from any ...

Go to the complete details ...