This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
static members are resolved (and thus initialised) in the order they are declared. As you're declaring k only after its first use in the initialisation of z you're getting an error. In the first case you're getting a forward reference which is resolved at runtime, in the second it's (attempted to be) resolved at compile time.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com