Static code blocks

Solution 1:

public class Application
{     

    static int attribute;     
    static Application()
    {         
         attribute = 5;     
    }    // removed
}

You can use the C# equivalent static constructors. Please don't confuse it with a regular constructor. A regular constructor doesn't have a static modifier in front of it.

I am assuming your //... rest of the code need to be also run once. If you don't have such code you can just simply do this.

 public class Application
 {     

    static int attribute = 5;
 }

Solution 2:

You just can write a static constructor block like this,

static Application(){
 attribute=5;
}

This is what I could think of.