Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
87 views

I am having 5 checkboxes. public enum animals : int { Cat = 1 ,Dog = 2 ,Mouse = 3 ,Rat = 4 ,Lizzard = 5 } On saving my window I can sum up they checkboxes that are ...
Philipp's user avatar
  • 17
-1 votes
1 answer
78 views

I'm trying to implement a simple switch between the control of 2 gameobjects in unity. Said switch can only happen when the entity you're switching from is grounded. Base Flags values The issue is ...
Gaspard GUILLOT's user avatar
2 votes
4 answers
294 views

How to generically combine all bits (I mean OR all values) of a [FLAGS] enum, having only valid values (bits) declared in the enum? Ex: [Flags] enum SuitsFlags { Spades = 1, Clubs = 2, Diamonds = 4, ...
Eric Ouellet's user avatar
2 votes
2 answers
388 views

If I have an enum class like so: class TestFlag(enum.Flag): A = enum.auto() B = enum.auto() C = enum.auto() D = A | B # valid Is it possible to specify a certain combination, such as, ...
tkott's user avatar
  • 460
0 votes
1 answer
1k views

As the title suggests, I'm wondering if there's a way to do a similar thing as in C# with flag enums, where if the object is printed to IO, it prints out the flags that are active, instead of an ...
Galgarius's user avatar
2 votes
2 answers
831 views

I have an enum that represents the directions you're allowed to move for a given cell in a maze: class Direction(Flag): NORTH = 1 EAST = 2 SOUTH = 4 WEST = 8 NE = NORTH | EAST ...
codebreaker's user avatar
0 votes
1 answer
1k views

Consider the following simple Flags Enum in C#: [Flags] public enum CountingEnum { Zero = 0, One = 1 << 0, Two = 1 << 1, Three = Two | One, Four = 1 << 2, ...
bopapa_1979's user avatar
  • 9,257
0 votes
4 answers
2k views

I would like compare two flags and see if they have any common value. I'ld like having an extension method as weel in order to "speed up" coding (I'm going to use it often and on various ...
ProtoTyPus's user avatar
  • 1,324
3 votes
0 answers
530 views

I'm trying to use enum in C to create a flags variable, as discussed here: Flags, enum (C) How should I reset a single enum flag, when the compiler represents the enum as signed? Problem: Say I ...
Luminaire's user avatar
  • 334
1 vote
2 answers
718 views

I'd like to use named constants whereever possible instead of providing literal values or longish function signatures with a lot of boolean args. Therefore i like pythons enum.Flag or enum.Enum. More ...
Wör Du Schnaffzig's user avatar
1 vote
1 answer
1k views

I have an Enum with [Flags] attribute like this: [Flags] public enum FlagStatus { Value1 = 1 , Value2 = 2 , Value3 = 4 } And my query for EF like this: x => x....
Allan Michaelsen's user avatar
1 vote
1 answer
345 views

I am using typescript to declare enum of type flag as following export enum OperatorEnum{ None = 0x0, Equal = 0x1, NotEqual = 0x2, GreaterThan = 0x4, LessThan = 0x10, ...
s.alhaj's user avatar
  • 121
0 votes
0 answers
133 views

I have a class which has an instance variable of type enum.Flag. It implements __getattr__ so that i can return the boolean state of a flag given by name. The code works fine when running without ...
Wör Du Schnaffzig's user avatar
0 votes
2 answers
592 views

I have recently started using enums to more efficiently store information in a database. I was wondering if there is some way to use them to store multiple true values. To elaborate, in a enum such as ...
Bubinga's user avatar
  • 713
0 votes
1 answer
306 views

My .NET backend handle enum authorization with HasFlag() Enum Foo { 0: Zero, 1: One, 2: Two, 3: Three, .. } 5.HasEnum(Foo.One) is falsy because 5 is equal to 3 + 2 6.HasEnum(Foo.One) is ...
Delbo ar's user avatar
  • 372
6 votes
3 answers
4k views

I am trying to check if an "enum instance" contains more than one flag. [Flags] public enum Foo { Bar = 1, Far = 2 } var multiState = Foo.Bar | Foo.Far; MoreThanOneFlag(multiState); // True ...
Twenty's user avatar
  • 6,221
1 vote
2 answers
171 views

I was looking at the summary of the StringSplitOptions enum and and then was surprised to see it has the Flags attribute applied to it. The Flags enum is relevant for things like BindingFlags where ...
nalka's user avatar
  • 2,806
0 votes
1 answer
116 views

First of all I am very sorry for the title, but its quite impossible (for me) to come up with a fitting title. The problem is as follows, I have a Enum where a value is composed from flags of two ...
Prophet Lamb's user avatar
2 votes
1 answer
244 views

I have created a custom class that extends enum.Flag: from enum import Flag class StrFlag(Flag): def __new__(cls, verbose): value = len(cls.__members__) obj = object.__new__(cls) ...
Bartleby's user avatar
  • 1,471
1 vote
1 answer
305 views

I'm working on 6502 emulator in C++ as a part of my thesis. It has 6 registers, most of them just hold values but there's one special - Processor Status. It's 8 bit wide and each bit means a ...
Sebastian Kucharzyk's user avatar
9 votes
2 answers
18k views

In C# (using Unity working on a game) I have an enum with the [Flag] attribute. I have instantiated it twice. I would like a way to compare the two enums. Specifically if enum A (which will have ...
George Barron's user avatar
2 votes
1 answer
596 views

I have a flag Enum called Role and an extension method called AddRole, that takes a Role enum and an int that works like a flag and only contains ones and zeros, where each 1 represents a role that a ...
agnete's user avatar
  • 23
0 votes
1 answer
223 views

I have a enum: [Flags] public enum Role { Basic = 0, A = 1, B = 2, C = 4, D = 8 } I store this value to DB in int column Role where Role = A | B | C (for example), so I'm using ...
A. Gladkiy's user avatar
  • 3,502
1 vote
1 answer
563 views

I am developing custom WPF UserControl which has few Dependency Properties. One of the properties is enum flags. I am trying to check if it is possible to set this property from Designer in property ...
Ihar I.'s user avatar
  • 11
2 votes
2 answers
638 views

I have this enum with Flags attribute [Flags] public enum Animal { Null = 0, Cat = 1, Dog = 2, CatAndDog = Cat | Dog } And use C# 7.3 which allows type constraints like: where T : ...
Степан Ермаков's user avatar