C# Reference - C# Modifiers - readonly - C# Reference - C# Modifiers - readonly
The LBTT Spot
"Lifeline is focused on developing and marketing systems designed to assist in the early detection of breast and ovarian cancer."



C# Reference - C# Modifiers - readonly

View C# Source Code

Article Categories:

.Net Framework
.Net Framework 1.1
ADO.NET
ASP.NET
Assemblies
Asynchronous Methods
C#
Collections
Configuration
Delegates
Events
Pocket PC
Regular Expressions
Smart Devices
SQL Server
Visual C#
Visual Studio .NET
Visual Studio .NET 2003
Windows Forms
XML

C# .Net Fun Menu

View Current Page's ASP.NET Source Code
C# Reference
C# Study Flash Cards
Valuable Links
Contact Us
Site Map
Mike's Portfolio

C# Reference Search:

Full Text Search:

Articles by Author:

Code Examples (zipped):

C# Reference
      C# Modifiers
           readonly


  • C# Modifiers: [readonly] Reference from Microsoft®


  • Use the readonly keyword on a field (aka variable) to ensure that it cannot be altered. The difference between a constant and readonly field is that a readonly field can also be changed within the constructor (see Class and Struct Constructors) method body of a class (a constant cannot). public class myClass { public readonly String myString = "OK!"; // constructor method: public myClass() { // we can change the myString field from here too! myString = "NOT!"; } }