VisualStudioFeeds

All Visual Studio blogs in one place

AddThis Social Bookmark Button
To some readers, the title of this post may induce nightmarish recollections of late-night debugging sessions. To others it may be simply the epitome of jargon. Just to break the jargon down a bit: Type initializer: the code executed to initialize the static variables of a class, and the static constructor Circular dependency: two bits of code which depend on each other - in this case, two classes whose type initializers each require that the other class is initialized A quick example of the kind of problem I'm talking
about would be helpful here. What would you expect this code to print?
using System;

class Test
{    
    static void Main()
    {
        Console.WriteLine(First.Beta);
    }
}

class First
{
    public static readonly int Alpha = 5;
    public static readonly int...(Read whole news on source site)

Search

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Home : Blog List : Jon Skeet: Coding Blog : Type initializer circular dependencies