I suggest you ...

Add static indexers

Altough there was this comment on the very same proposal: "Thanks for taking the time to share this suggestion. This item has been around for a couple of versions of Visual Studio and we haven’t acted on it. Looking at the VS “15” plans, we’re not going to take action on this item, so we’re going to close it. If the suggestion is still relevant, please either take a look to see if there’s another suggestion that’s similar that you can vote on, or open a new suggestion."

I do suggest the very same thing: static indexers.

Currently, indexers need an instance reference ("this"). To "hide" nitty-bitty domain-specific stuff, it would still be nice (and IS NECCESSARY) to be able to access this stuff from a SINGLE place (static, not a singleton, because certain stuff is universal, not a singleton universe within a multiverse...).

This is about software architecture. Yes, there are countless ways to implement such a feature, but each and any of these violate even the simplest rules of clean coding.

Do you suggest "var math = new Math(); var c = 2 * math.Pi * r;"? No, you won't, will you? So, if there was a similar class "MathConsts" that provided consts like Pi, e, Heisenberg, the gravitational Const, the mass of a Tachyon, 42, whatnot, and I wanted to access them by "MathConsts["Pi"]", why should I "var mathConsts = new MathConsts(); var c = 2 * mathConsts["Pi"] * r;" instead of "MathConsts["YourBestConstantMankindEverNeeded"]"?

Actually, I'm not so much dealing with physics or science-fiction. Instead I'm dealing with German Railways stuff, and there are a lot constants who are, in this domain, like laws, and laws are "god-like", thus static for "my universe", not an instance.

3 votes
Vote
Sign in
(thinking…)
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Carsten Posingies shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...
  • Carsten Posingies commented  ·   ·  Flag as inappropriate

    Just to make this clear: I don't want Math.Pi replaced by Math["Pi"] just so. Indexers can be smart while properties cannot without breaking the very rules of clean coding.

Feedback and Knowledge Base