Replies: 15 comments
-
Beta Was this translation helpful? Give feedback.
-
So, when you declare variable as If this is just about IntelliSense, then you don't need to change the language. For example, you could have a normal class and point IntelliSense to it using an attribute: public void DoSomething(
[Suggestion(typeof(MyStringOption))] string event,
[Suggestion(typeof(KnowenFoo))] Foo foo) |
Beta Was this translation helpful? Give feedback.
-
@svick Is there a real |
Beta Was this translation helpful? Give feedback.
-
@John0King I don't believe there is. I'm just suggesting an alternative solution. |
Beta Was this translation helpful? Give feedback.
-
Does that mean I'm OK with method expose the actual type. but it better can be extend by another package.
well , Besides, "the |
Beta Was this translation helpful? Give feedback.
-
@John0King why this doesn't work for you? public class Foo { ... }
public class ChildFoo:Foo { ... }
public class ExtendFoo:Foo{ ... }
public enum MyStringOption
{
Click,
Tap
}
//some method
public void DoSomething(MyStringOption event,Foo foo) I also don't understand how client could pass |
Beta Was this translation helpful? Give feedback.
-
you can pass |
Beta Was this translation helpful? Give feedback.
-
It's a shame that C# allows this. However, I understand, why - it's because of leaky serialization abstraction. But normally it shouldn't be allowed. Your code cannot use this Sorry, but I don't see any value in this suggestion. You either has some predefined set of possible actions - then you can use public static readonly properties for them, see HttpMethod as example, or you don't have it - then I don't see any reason to limit client: just allow him to pass anything of this type and work with it. If you want to extend default custom values by something else you probably may want #192 |
Beta Was this translation helpful? Give feedback.
-
The goal of this feature is replace those static readonly properties to a "virtual type" that has intellsence. |
Beta Was this translation helpful? Give feedback.
-
@John0King I'm not sure we are talking about the same. I have intellisense for HttpMethod, it doesn't fit you? |
Beta Was this translation helpful? Give feedback.
-
I'm with @svick, I don't think that this proposal necessitates any changes to the language proper. I think that if the functionality requested is found to be compelling that it could be achieved through attributes which could be added to the BCL. Visual Studio already uses quite a few attributes to drive the behavior of the tooling including hiding members from Intellisense. |
Beta Was this translation helpful? Give feedback.
-
😄 OK, ReSharp win. and my idea is something like this
only intellsence does not work today . |
Beta Was this translation helpful? Give feedback.
-
@John0King This is question about tooling, not about language itself. I believe that with "extension everyting" you could just add your custom static fields (for example static "Extension everything" is highly demanded, so I expect it to be implemented realatively soon. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Is this feature you need ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I had this idea for several months. I want something like
the
options
is just a staticDictionary<string,T>
,It's not try to replace Enum, the goal is to provide more information to intellsense.This is usefull for when you create a method like
new System.Text.Encodings.Web.TextEncoderSettings(System.Text.Unicode.UnicodeRanges.All))
thestatic class
UnicodeRanges
is better written asoptions<UnicodeRange>
but since "options" maybe a very common variable name, may be there's a better name for this feature
Beta Was this translation helpful? Give feedback.
All reactions