如何在C#中定义一个可以更改所有方法和类的布尔变量? [英] How to define a Boolean variable in C # that of all methods and classes can be changed?

查看:227
本文介绍了如何在C#中定义一个可以更改所有方法和类的布尔变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 在Visual Basic 6.0中控制程序的早期事件将执行与我相同的操作.
图像
例如,用户可以点击或不点击X按钮,来从ChekBox获得帮助
并且将Visible属性设置为False,它是在用户单击Button ChekBox.Value = 1
时制成的 在这种情况下的编程工作进展顺利,但我原则上喜欢这样做
这表示类型为Boolean变量定义的全局变量,然后单击Button,我是True.重新完成:

 公共 静态  class 基础架构
{
 public  静态  bool 名称;
} 



您可以在所有解决方案中使用以下名称访问该名称:Infrastructure.name


hi Earlier events in Visual Basic 6.0 to control the program would do the same thing I .
image
For example, the user can click on the X Button or not, come and get help from a ChekBox
and Visible property to False and it was made ​​and when the user clicks on Button ChekBox.Value = 1
Programming work in this situation was going well but I like to do this in principle do
This means that a global variable of type Boolean variable definition, and I click on the Button, I''m True.?

解决方案

Create this class and you''re done :

public static class Infrastructure
{
public static bool name;
}



it is accessible in all your solution under the this name : Infrastructure.name


这篇关于如何在C#中定义一个可以更改所有方法和类的布尔变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆