<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FClass_Interface%2Freadonly</id>
		<title>Csharp/C Sharp/Class Interface/readonly - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FClass_Interface%2Freadonly"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/readonly&amp;action=history"/>
		<updated>2026-04-29T21:21:24Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/readonly&amp;diff=612&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/readonly&amp;diff=612&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/readonly&amp;diff=613&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/readonly&amp;diff=613&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:10Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Demonstrate readonly==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Demonstrate readonly. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
class MyClass { &lt;br /&gt;
  public static readonly int SIZE = 10; &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class DemoReadOnly { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    int[]nums = new int[MyClass.SIZE]; &lt;br /&gt;
 &lt;br /&gt;
    for(int i=0; i&amp;lt;MyClass.SIZE; i++) &lt;br /&gt;
      nums[i] = i; &lt;br /&gt;
 &lt;br /&gt;
    foreach(int i in nums) &lt;br /&gt;
      Console.Write(i + &amp;quot; &amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
    // MyClass.SIZE = 100; // Error!!! can&amp;quot;t change &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ReadOnly Fields==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
class Tire {&lt;br /&gt;
    public static readonly Tire GoodStone = new Tire(90);&lt;br /&gt;
    public static readonly Tire FireYear = new Tire(100);&lt;br /&gt;
    public int manufactureID;&lt;br /&gt;
    public Tire() { }&lt;br /&gt;
    public Tire(int ID) { manufactureID = ID; }&lt;br /&gt;
}&lt;br /&gt;
class Employee {&lt;br /&gt;
    public readonly string SSN;&lt;br /&gt;
    public Employee(string empSSN) {&lt;br /&gt;
        SSN = empSSN;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
class Program {&lt;br /&gt;
    static void Main(string[] args) {&lt;br /&gt;
        Tire myTire = Tire.FireYear;&lt;br /&gt;
        Console.WriteLine(&amp;quot;ID of my tire is: {0}&amp;quot;, myTire.manufactureID);&lt;br /&gt;
        Employee e = new Employee(&amp;quot;111-22-1111&amp;quot;);&lt;br /&gt;
        // e.SSN = &amp;quot;222-22-2222&amp;quot;; // error!&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Readonly Property==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
//VersionTest&lt;br /&gt;
public class VersionReporter {&lt;br /&gt;
    public static string version {&lt;br /&gt;
        get {&lt;br /&gt;
            return &amp;quot;2.0.0.0&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public VersionReporter() {&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class VersionOutput {&lt;br /&gt;
    static void Main(string[] args) {&lt;br /&gt;
        string ver = VersionReporter.version;&lt;br /&gt;
        Console.WriteLine(&amp;quot;Using version {0}&amp;quot;, ver);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The use of readonly fields==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Mastering Visual C# .NET&lt;br /&gt;
by Jason Price, Mike Gunderloy&lt;br /&gt;
Publisher: Sybex;&lt;br /&gt;
ISBN: 0782129110&lt;br /&gt;
*/&lt;br /&gt;
/*&lt;br /&gt;
  Example6_3.cs illustrates the use of readonly fields&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// declare the Car class&lt;br /&gt;
class Car&lt;br /&gt;
{&lt;br /&gt;
  // declare a readonly field&lt;br /&gt;
  public readonly string make;&lt;br /&gt;
  // declare a static readonly field&lt;br /&gt;
  public static readonly int wheels = 4;&lt;br /&gt;
  // define a constructor&lt;br /&gt;
  public Car(string make)&lt;br /&gt;
  {&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Creating a Car object&amp;quot;);&lt;br /&gt;
    this.make = make;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Example6_3&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Car.wheels = &amp;quot; + Car.wheels);&lt;br /&gt;
    // Car.wheels = 5;  // causes compilation error&lt;br /&gt;
    // create a Car object&lt;br /&gt;
    Car myCar = new Car(&amp;quot;Toyota&amp;quot;);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;myCar.make = &amp;quot; + myCar.make);&lt;br /&gt;
    // myCar.make = &amp;quot;Porsche&amp;quot;;  // causes compilation error&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>