为什么我们在.net中使用标志 [英] why we use flag in .net

查看:107
本文介绍了为什么我们在.net中使用标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海,


我在flag.plz中有疑问,请告诉我.net中flag的用途是什么以及为什么使用它.

Hai,


I am having doubt in flag.plz tell me what is the use of flag in .net and why we used it.

推荐答案

标记变量是通知值可以由其预期的用户模块读取,以获取所需的通知以继续或停止该过程.有条件地,标志的值只能由一个进程更改,而由其他进程读取.
标志主要是布尔值,但也取决于场景,它甚至可以是数字,甚至可以是字符.
Flag variable(s) are the notification value, which can be read by its intended user modules, to get the required notification to continue or to stop the process. Conditionally the value of flag is changed by only one process and read by other.
Flags are mostly in boolean, but it also depends upon the scenarios, where it can be even numeric or even in characters.


它也是枚举器的可能属性:

It''s also a possible attribute for enumerators :

[Flags]
public enum MyProperties { None=0, Left=1, Right=2, Center=4, Top=8, Bottom=16, Middle=32, All=64 }



请转到此处查看完整的示例(并向下滚动到标记为 枚举类型作为位标志的部分 ))

http://msdn.microsoft.com/en-us/library/cc138362.aspx [ ^ ]



Go here for a complete example (and scroll down to the section labeled Enumeration Types as Bit Flags)

http://msdn.microsoft.com/en-us/library/cc138362.aspx[^]


标志只是一个布尔变量,用于指示特殊情况,例如
A flag is just a boolean variable used to indicate a particolar condition, for instance
bool done;



done可能是false,而操作仍在进行中,而在操作完成后变成true.



done might be false while an operation is still in progress and become true after the operation is completed.


这篇关于为什么我们在.net中使用标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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