473,378 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

flags

what does this at the begining of a class mean?
[Flags]


Nov 16 '05 #1
3 2593

"ichor" <ic***@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
what does this at the begining of a class mean?
[Flags]
It marks an enum as being a set of flags(ie a bitfield). The only visible
effect you'll see while using C# is that ToString() recognizes it and
results in a list of values ("EnumVal1, EnumVal2" for example) instead of
the name of the singular enum value.

Its possible that in other languages, Flags may be required to perform & and
| 's against it.


Nov 16 '05 #2
hi ,
I want to simulate the chmod utility in unix where

chmod 777 gives everyone all access.

how do i create an enum so that 4 means read and write perm.

(read=1
write=3
full=7 not sure about chmod values for read write and execute.)

can anyone give me an idea how to go about it?
thnx
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:#0**************@TK2MSFTNGP09.phx.gbl...

"ichor" <ic***@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
what does this at the begining of a class mean?
[Flags]
It marks an enum as being a set of flags(ie a bitfield). The only visible
effect you'll see while using C# is that ToString() recognizes it and
results in a list of values ("EnumVal1, EnumVal2" for example) instead of
the name of the singular enum value.

Its possible that in other languages, Flags may be required to perform &

and | 's against it.




Nov 16 '05 #3
frazer,
It is "rwx" binary bits repeated three times for owner, group and others.
In Unix, 4 is read, 2 write, and 1 execute. Therefore, read and write for
owner would be 600 octal.
In windows, unfortunately the Attrib command has ReadOnly, Archive, System,
and Hidden attributes.
Moreover, the permission are not divided into owner, group and everyone.
They are far more sophisticated.
While in C or C# you may simulate the bitfields, the O/S level equivalent is
hard to obtain.

Thanks,
Fakher Halim
Software Architect,
TPG

"frazer" <ic***@hotmail.com> wrote in message
news:ek*************@TK2MSFTNGP11.phx.gbl...
hi ,
I want to simulate the chmod utility in unix where

chmod 777 gives everyone all access.

how do i create an enum so that 4 means read and write perm.

(read=1
write=3
full=7 not sure about chmod values for read write and execute.)

can anyone give me an idea how to go about it?
thnx
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:#0**************@TK2MSFTNGP09.phx.gbl...

"ichor" <ic***@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
what does this at the begining of a class mean?
[Flags]


It marks an enum as being a set of flags(ie a bitfield). The only visible effect you'll see while using C# is that ToString() recognizes it and
results in a list of values ("EnumVal1, EnumVal2" for example) instead of the name of the singular enum value.

Its possible that in other languages, Flags may be required to perform &

and
| 's against it.





Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Xah Lee | last post by:
Python re module has methods flags and pattern. How to use these exactly? e.g. i tried print patternObj.flags() and the error is some "int object is not callable". ...
7
by: loquak | last post by:
Greets. I wonder which way would be the best for holding some state flags in terms of memory use and efficiency. a) struct FLAGS { bool flag1 : 1; bool flag2 : 1;
6
by: Alexis Gatt | last post by:
Hi guys, I was reading the source code of a lib, and I came across this odd way of defining flags #define PHONG_RV (0<<0) #define PHONG_NH (1<<0) Here is how they're used:
13
by: Mark A. Odell | last post by:
I write a lot of drivers and there is inevitably some hardware register or buffer descriptor field called 'flags'. The flags are defined, typically, as bit positions. I was thinking I could get...
3
by: Ignacio X. Domínguez | last post by:
Hi. I'm using the | operator to use multiple flags in a variable. For example: const int flag1 = 0x00000001; const int flag2 = 0x00000002; const int flag3 = 0x00000004; int Flags = flag2 |...
1
by: todorov-fkt | last post by:
Hello everyone, I have a field which is 1 byte long and is used to store different flags (according to specs) - it is the flags bit in the ID3 tag header. So 0xabc00000 represents the byte,...
1
by: Dwight.Dexter | last post by:
I have an enum variable. Is there some way to cast an int or BitArray and get my enum value? I have to communicate with an old C-style sever so I get an array of bits("0","1"). But I'm using an...
1
by: RicercatoreSbadato | last post by:
I have notice that my images have the value Image.Flags = 2 (HasAlpha). How Can I set the Flags to 1? I would like to eliminate the alpha channel... -- RicercatoreSbadato
4
by: Joel Moore | last post by:
Say I have an enum similar to this: <Flags()> Enum TestFlags As Short One = 0 Two = 1 Three = 2 Four = 4 End Enum I figured I could declare variable of type TestFlags to be used in the
1
by: Alexander Korsunsky | last post by:
Hi! Is it possible to extract the mode flags of a stream (FILE* stream or fstream - object), without looking at how the stream was opened? What I mean by mode flags is wether the stream is opened...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.