Skip to main content
edited body
Source Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

with a simple conversion to string as:

var value = IGreetYou.Hi | IGreetYou.Hello;
var asString = Convert.ToString((uint)value, 2);   // 11

If the size of the collection is fixeddynamic:


If the size of the collection is dynamicfixed:

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

with a simple conversion to string as:

var value = IGreetYou.Hi | IGreetYou.Hello;
var asString = Convert.ToString((uint)value, 2);   // 11

If the size of the collection is fixed:


If the size of the collection is dynamic:

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

with a simple conversion to string as:

var value = IGreetYou.Hi | IGreetYou.Hello;
var asString = Convert.ToString((uint)value, 2);   // 11

If the size of the collection is dynamic:


If the size of the collection is fixed:

added 154 characters in body
Source Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

with a simple conversion to string as:

var value = IGreetYou.Hi | IGreetYou.Hello;
var asString = Convert.ToString((uint)value, 2);   // 11

If the size of the collection is fixed:


If the size of the collection is dynamic:

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

If the size of the collection is fixed:


If the size of the collection is dynamic:

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

with a simple conversion to string as:

var value = IGreetYou.Hi | IGreetYou.Hello;
var asString = Convert.ToString((uint)value, 2);   // 11

If the size of the collection is fixed:


If the size of the collection is dynamic:

Source Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101

I challenge the need for a list of booleans. There are alternatives available in the .NET Framework that deal with a sequence of booleans.


If the flags are static and fixed:

[Flags]
enum IGreetYou : uint
{
    None  = 0,
    Hi    = 1 << 0,
    Hello = 1 << 1,
    Yow   = 1 << 2
}

If the size of the collection is fixed:


If the size of the collection is dynamic: