Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 8 Language Overviewprevious at this levelnext at this level 8.7 Classesprevious at this levelnext at this level 8.7.10 Static constructorsA static constructor is a member that implements the actions required to initialize a class. Static constructors cannot have parameters, they cannot have accessibility modifiers, and they cannot be called explicitly. The static constructor for a class is called automatically. The example
using Personnel.Data;  
class Employee  
{  
   private static DataSet ds;  
   static Employee() {  
      ds = new DataSet(...);  
   }  
   public string Name;  
   public decimal Salary;  
   ...  
}  
shows an Employee class with a static constructor that initializes a static field.
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS