Wednesday, September 18, 2013

Why a variable declared in a class globally is not visible/accsible in same class method?

Why a variable declared in a class globally is not visible/accsible in
same class method?

i made a class in app code folder in visual studio 2010. when i declared
any variable outside of a method(globally), it can't be visible in that
method. I am new in asp.net, may be i make any mistake but i can't catch
that. So i need some help. my code is as follow...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class Class2
{
public Class2()
{
//
// TODO: Add constructor logic here
//
}
int i;
public static void calculate(string)
{
// here want that variable but i can't get it in intelliscence.
}
}

No comments:

Post a Comment