【发布时间】:2012-01-17 13:09:52
【问题描述】:
从Java 到C# 我有以下问题:
在java中我可以做到以下几点:
public class Application {
static int attribute;
static {
attribute = 5;
}
// ... rest of code
}
我知道我可以从构造函数初始化它,但这不符合我的需要(我想初始化并调用一些实用程序函数而不创建对象)。 C# 支持这个吗?如果是,我该如何完成?
提前致谢,
【问题讨论】: