accessing variables cross .cs files

Results 1 to 2 of 2

Thread: accessing variables cross .cs files

  1. #1
    Join Date
    Dec 1969

    Default accessing variables cross .cs files

    Hi,<BR><BR>I&#039;m very new to C#!!<BR><BR>I am creating a utility which will need a set of constants and functions.<BR><BR>I need to create a .cs file to store all the contants an a couple of functions.<BR>Then I need to be able access these contants from a number of other .cs files.<BR><BR>I have created the Constants.cs file and another file (LoaderUtil.cs) but I don&#039;t know what I need to do to be able to access the contants from within LoaderUtil.cs!!<BR><BR>I have created the two files within the same project and have given them both the same namespace (LoaderNS)!!<BR><BR>When I try to use a contant that is declared in Constants.cs from inside LoaderUtil.cs, I get an error "C:WorkCSharpWebUtilLoaderUtil.cs(26): The name &#039;ROW_ID_EXC&#039; does not exist in the class or namespace &#039;LoaderNS&#039; !<BR><BR><BR>I appreciate any help <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: accessing variables cross .cs files

    1. Compile Constants.cs<BR>2. Reference Constants.dll from your project<BR>3. Access the constants like this: Constants.ROW_ID_EXC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts