作者: dreamfly 分类: c# 发布时间: 2020-03-31 11:22





 public static class common
    public static int currentNum { get; set; }


例如: 我们可以在任意函数中对它进行获取和设置。

common.currentNum = 20;

int num = common.currentNum;

static 变量 vs 全局变量


static int a;
int b;

extern int b;




因此,如果您有一个全局变量并将您的文件作为库进行分发,并且希望其他人不要访问您的全局变量,则可以通过仅在关键字前缀上添加前缀来使其变为静态(当然,如果您的其他文件中不需要相同的变量) )。


  • Neeheri

    2022年3月29日 20:47

    Vyovze https://oscialipop.com – viagra vs cialis acheter cialis 20mg ligne Dfofks Cialis cialis generique 20mg His contemporary and fellow wanderer around Europe was Heinrich Cornelius Agrippa von Nettesheim usually known as Cornelius Agrippa. Bhnsmo https://oscialipop.com – Cialis

  • ValfKeeli

    2022年7月27日 02:03

    This shifted the criteria for death from card iorespirator y IRON LUNG This mechanical ventilator was adapted in the s to provide positive pressure to enable patients with brain damage to breathe. Cialis

  • Obedoms

    2022年8月15日 06:41

    How Long Does It Take Zithromax To Start Working buy ivermectin 12 mg online Levitra Rendeles

  • Accedge

    2022年9月2日 10:20

    Although the focus of this investigation was on LUTS, IIEF-EF domain scores were noted to improve significantly at all time points 4, 8, and 12 weeks , with mean change from baseline at the 12-week time point 5 buy cheap cialis online

  • sconfourn

    2022年9月4日 16:49

    buy priligy in usa Viagra can also interact with certain medications, including medications used to treat high blood pressure and other cardiovascular health issues

  • unconia

    2022年9月6日 15:41

    cialis Friday, 25 February, 2022 by Garrett Soucy

  • Tandaxami

    2022年9月9日 00:50

    cialis for daily use Liu Chengyou started again, asking about the affairs of the Liao Kingdom, the Liao Emperor s western tour, expressing pity for the death of Yelu Wuzhi, and expressing his willingness to send troops to help Kanping Yishen friendship for round sex bed 100 Natural Formulation his internal rebellion

  • ancelay

    2022年9月11日 14:09

    12 clomifene or clomiphene or clomid TI,AB,KY 1066. dose clomid 6 Application Site Injection Site Pain 4 4.

  • sterulp

    2022年9月14日 19:31

    Methods Ninety-four women received the letrozole HMG, 90 women received CC HMG, and 71 women received HMG only. nolvadex Okra Water has also been reported to help with weight loss.

  • Lerlore

    2022年9月18日 08:02

    Corneal angiography, using fluorescein and indocyanine green, provides details of the neovascular complexes, thus enabling accurate evaluation of corneal vessel anatomy and activity 38. doxycycline without prescription