C#中的全局变量 [英] Global variables in C#

查看:112
本文介绍了C#中的全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在C#中创建一个可以使用的''全局变量'并在表单之间访问
?我在Visual Basic中使用了MODULES,但是找不到与C#相当的

...


感谢所有响应,

解决方案

您在寻找静态变量吗?


-James


是 - 可以在应用程序中用户

触及的任何形式内操作的变量。

" james"写道:


你在寻找静态变量吗?


-James


我不认为在C#中有相同的东西,你可能想要使用

静态类,这对你做同样的事情。


Sam


" vbtrying" < vb ****** @ discuss.microsoft.com写了留言

新闻:DB ********************** ************ @ microsof t.com ...


是否可以在C#中创建''全局变量''可以使用和

表格之间访问?我在Visual Basic中使用了MODULES,但是找不到



相当于C#...


感谢所有回复者,



Is it possible to create a ''global variable'' in C# that can be used and
accessed between forms? I''ve used MODULES in Visual Basic, but can''t find the
equivalent for C# ...

Thanks to all those responding,

解决方案

Are you looking for static variables?

-James


Yes - variables that can be manipulated inside of any form that the user
touches during the application.
"james" wrote:

Are you looking for static variables?

-James


I don''t think there is something equivalent in C#, you might want to use
static class which kinda does the same thing for you.

Sam

"vbtrying" <vb******@discussions.microsoft.comwrote in message
news:DB**********************************@microsof t.com...

Is it possible to create a ''global variable'' in C# that can be used and
accessed between forms? I''ve used MODULES in Visual Basic, but can''t find
the
equivalent for C# ...

Thanks to all those responding,



这篇关于C#中的全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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