CSharp examples for Custom Type:read only
Initialize read only field in constructor
using System;/*from w w w . ja v a 2s .co m*/ class Account { public readonly string AccountNumber; public Account (string permanentAccountNumber) { AccountNumber = permanentAccountNumber; } } class SimpleBank { public static void Main() { Account yourAccount = new Account("8487-9873-9938"); Console.WriteLine("Your account number: " + yourAccount.AccountNumber); } }