Search Results

Search found 1 results on 1 pages for 'devfreak'.

Page 1/1 | 1 

  • How can make a variable (not class member) "read only" in C#

    - by devfreak
    Hi, I'm new to the C# world and I can't find a method to declare read only variable in C# (something like declaring "const" variable in c++). Is there one? I'll give you an example: ... int f() { return x; } // x is not const member ... void g() { int readOnlyVar = f(); // is there a method to declare readOnlyVar as read only or const // Some code in which I want to restrict access to readOnlyVar to read only }

    Read the article

1