什么是enum.HasFlag()? [英] What is enum.HasFlag() ?

查看:431
本文介绍了什么是enum.HasFlag()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解enum.HasFlag()的功能,

I want to understand the function of enum.HasFlag(),

Console.WriteLine(gender.female.HasFlag(gender.male));



其中enum范围是




where the enum scope is

enum Gender
{
male,
female
}

推荐答案

请看我对这个问题的评论。



看来你需要读这个:

http://msdn.microsoft.com/en-us/library/system.enum.hasflag.aspx [ ^ ]

< u> http://msdn.microsoft.com/en-us/library/system.flagsattribute。 aspx [ ^ ] 。



但坦率地说,有些事情对你来说更重要: Microsoft Q209354



请不要冒犯,你真的需要掌握一些阅读和理解的基本技能。问题很神奇。这种方法和属性没有隐藏或棘手的东西。如果您不理解MSDN文章,则应首先阅读.NET属性及其用法,以及一般的枚举类型。如果你仍然无法理解它,你需要从基础知识开始,从程序,类型,它们的成员和变量,方法及其参数等的想法开始。



-SA
Please see my comment to the question.

It seems that you need to read this:
http://msdn.microsoft.com/en-us/library/system.enum.hasflag.aspx[^],
http://msdn.microsoft.com/en-us/library/system.flagsattribute.aspx[^].

But frankly, there is something which is much more important for you: Microsoft Q209354.

Please, no offense, you really need to develop some elementary skills in reading and understanding. The question is amazing. There is nothing hidden or tricky in this method and attribute. If you don''t understand the MSDN article, you should first read the the .NET attributes and their use, and maybe about enumeration types in general. If you still cannot understand it, you need to go to the very basics, starting from the idea of a program, types, their members and variables, methods and their parameters, and so on.

—SA


这篇关于什么是enum.HasFlag()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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