C#窗口应用程序中的访问修饰符 [英] Access Modifier in C# window application

查看:244
本文介绍了C#窗口应用程序中的访问修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

关于访问修饰符可见性级别的使用,我有些困惑.情况如下:

我在Enable = False模式下有一个窗体(form1)的计时器控件(tmr1,作为专用模式).现在,我要根据另一种形式为form2的button1_Click事件启用该tmr1.因此,将tmr1的访问说明符设为内部并从form2启用它是安全的吗??? :confused:

Dear all,

I have a little confusion regarding the use of access modifier visibility level. the situation is like below:

I have a timer control (tmr1, as private mode) in Enable=False mode, in a form (form1). Now I want to enable that tmr1 depending upon a button1_Click event of another form say form2. So is it safe to make that tmr1''s access specifier internal and make it enable from the form2??? :confused:

推荐答案

与其保持定时器成员private 并添加内部方法:

Rather than do that it would be better to keep the timer member private and to add an internal method:

internal void EnableTimer(){...}


是的.您可以放心地将其设置为内部.
Yes. You may safely make it internal.


这篇关于C#窗口应用程序中的访问修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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