This project has moved and is read-only. For the latest updates, please go here.

Default value for Flags

Mar 26, 2010 at 3:18 PM

First of all, congrats for the new release. Great additions!

It seems that by default the Flag is used which doesn't include static members, at least this is the case for methods. Why? I'd prefer something like Flags.All is used as default which includes every member.

Also it's a bit hard at the moment to find the right Flag. So why not define Flags.All? Plus Flags.Default which is used in the methods without the flag parameter (Flags.Default = Flags.All).

Mar 26, 2010 at 3:47 PM

We did discuss what flags values to use as the default and settled on using Flags.InstanceAnyVisibility, mostly because we believe this to be the most common usage scenario. You can use Flags.StaticInstanceAnyVisibility to include all members.

We've done our best with the wiki documentation and it does include documentation for all of the supported Flags values. See the Getting Started page if you haven't already done so.

As for the rather long names we felt it would make both your and our code more readable with more explicit names. Default or All does not really communicate much about what flags are actually specified, and All would be confusing as we also have flags that when set will filter the returned results.

If you dislike how much space it eats up on a source line, add a selector class like this (so you can use e.g. F.All instead):

public static class F { public static Flags All { get { return Flags.StaticInstanceAnyVisibility; } } }

Mar 26, 2010 at 9:34 PM
Edited Mar 29, 2010 at 10:36 AM

The length is not the problem. We have big screens and Intellisense nowadays. ;-) It's just not that easy discoverable that Flags.StaticInstanceAnyVisibility actually means all members. That's why I'd add Flags.All which in fact only returns Flags.StaticInstanceAnyVisibility, but everyone would know what's going on without reading the docs. And the Flags.Default makes it easily discoverable what is used in the extensions methods as default.

I wouldn't want to change the existing Flags, only add two more that are actually just aliases for the existing ones.

Mar 26, 2010 at 9:46 PM

I see what you mean..

I'd support adding Flags.Default and Flags.AllMembers as aliases for the existing flags. I'm not fond of Flags.All as it's unclear whether this means "all flags" or "all members".

Added issue for this here:

Mar 26, 2010 at 11:18 PM

Great, sounds good. Thanks.