怎么样去申明静态变量?

来源:百度知道 编辑:UC知道 时间:2024/09/21 20:50:38
怎么样去申明静态变量?

public static int temp;

在类中
public class ABC
{
private static string x="abc"; //这是一个静态字符串
private static string A() //这是一个静态的函数。
{
return x;
}
}

通常就这两种了。一种是变量,一种可以是静态函数。

可以注意我们观察时知道,一般Main函数和其他经常事件调用的函数都是静态的。

static (int) ~ ;