C#定义全局变量,可以在各个窗体中使用

来源:互联网 发布:淘宝美工作品图片大全 编辑:程序博客网 时间:2024/06/03 14:21

要新建一个静态类

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace WindowsFormsApplication1{    static class  Gloable    {        public static string dengluhao;      }}

在其他窗体的使用的时候直接用Gloable.变量

0 0