What Language Features Do You Miss In C#?
-
OriginalGriff wrote:
Or, you could put both operations in methods and call them?
Not great for all scenarios. FYI, I am talking about "goto case", not "goto label". The former is limited in scope and so isn't plagued by the spaghetti caused by the latter. :)
That's not very nice at all: since cases aren't named, they would either have to be anonymous (in which case a maintenance PITA if I insert a case between this and the next) or "goto case myEnum.myValue" which is kinda repellent as well. :laugh:
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
Compile-time templates, C++ style. Generics are great, unless you want to restrict a generic type argument to be "addable" or something like that. Probably not going to happen, given the direction it's taking. Also nice, "break out of named-loop", Java-style.
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
Support to use untyped generics. That is, everytime I have a generic type I also create a non-generic interface so I can use the object without using reflection/dynamic but with a considerable good speed. But it would be great if that was automatic. That is: List<int> only accepts int. I receive it in as a List<> parameter. In this case, all the T parameters, usually seen as int, could be seen as object, doing the casts that are necessary... Well, for the List itself we can already use the IList... but it will be great to have such resource so we could avoid creating interfaces to allow "the more generic, non-generic" call (that is, more generic because it is untyped... I also hate the name generic... it should be typed... a typed list... the ArrayList is the generic one... hehe).
-
Telepathic interface and direct print to the coffee machine.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
You certainly go straight to The Heart of Everything[^]
Espen Harlinn Principal Architect, Software - Goodtech Projects & Services AS Projects promoting programming in "natural language" are intrinsically doomed to fail. Edsger W.Dijkstra
-
Support to use untyped generics. That is, everytime I have a generic type I also create a non-generic interface so I can use the object without using reflection/dynamic but with a considerable good speed. But it would be great if that was automatic. That is: List<int> only accepts int. I receive it in as a List<> parameter. In this case, all the T parameters, usually seen as int, could be seen as object, doing the casts that are necessary... Well, for the List itself we can already use the IList... but it will be great to have such resource so we could avoid creating interfaces to allow "the more generic, non-generic" call (that is, more generic because it is untyped... I also hate the name generic... it should be typed... a typed list... the ArrayList is the generic one... hehe).
Hmm. So, for every generic, you also get a Foo (with a better name)? Yeah, I could see how that might be handy for reuse: Bag, Bag etc. shoved into a generic Sort(Bag) method?
-------------- TTFN - Kent
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
sprintf sscanf
Steve Wellens
-
Hmm. So, for every generic, you also get a Foo (with a better name)? Yeah, I could see how that might be handy for reuse: Bag, Bag etc. shoved into a generic Sort(Bag) method?
-------------- TTFN - Kent
In my case, actually, for every Foo<T> I also have an IFoo where the parameters are as object instead of T. I think java have such feature (I know, in java the implementation is completely different)... I think they use: Foo<?> to say that they don't know the type being used. It is slower than having it rightly typed, but it is faster than having it as dynamic or through reflection.
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
Something from Transact SQL – the “in” clause. Something like:
if(myShoeSize in (16, 12, 17, 32) )
{
imAMutant = true;
}There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
Something from Transact SQL – the “in” clause. Something like:
if(myShoeSize in (16, 12, 17, 32) )
{
imAMutant = true;
}There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
There is
.Contains
. -
...And get derisive noises at the next code review! :laugh: Or, you could put both operations in methods and call them?
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
A
goto case
is not agoto
. But, yes, I don't likebreak
in aswitch
; in my opinionbreak
should only be for loops only. -
Something from Transact SQL – the “in” clause. Something like:
if(myShoeSize in (16, 12, 17, 32) )
{
imAMutant = true;
}There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
HashSet
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
Method-scoped variables like in VB (static). Defining Extension Methods by applying the Attribute like in VB (rather than
this
). A proper assignment operator like in Pascal:=
:-D A properdefine
directive like in C/C++# define Pi 3.14
Support forenum
inwhere
clauses for generic types --class C<T> where T : enum ...
No default modifiers (public
,private
,virtual
,sealed
, etc.). Multiple Inheritence would be good too. -
HashSet
Yes I know. We can also implement it in C++ using operator overloading. But the point is for a language future, not a pattern, collection or utility class.
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
There is
.Contains
.This one is type dependent and not a language future but some class method. Same as Split() (very useful method by the way) or IsNullOrEmpty() for example.
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
Yes I know. We can also implement it in C++ using operator overloading. But the point is for a language future, not a pattern, collection or utility class.
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
Yet HasSet allows other operations, such as union and intersection; would you argue for syntax to allow every such operation? I wouldn't.
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
What I would like to see in the language: - Destructors that destruct (not the silly Dispose() stuff) [you can easily trigger local garbage collection with an exit from scope] - Ability to use arrays with non-zero origin - inline operator||(), inline operator&&() which implement short circuit logic
-- Harvey
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
Multiple inheritance. Interfaces are useful as abstractions, but there are times I want to inherit concrete functionality from multiple classes. Marc
Latest Article: C# and Ruby Classes: A Deep Dive
My Blog -
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
I want lambda expressions, that can be evaluated at compile time, allowed in attributes, to avoid nasty string literals.
-
Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.
-------------- TTFN - Kent
Having a generic type constraint on operators. Something where T : +, -, >, < Or something. Or just provide one easy way to work with numerics, for example: Something where T : numeric After which you can use +, -, >, < etc. by default and T can be int16, int 32, int64, single, byte, double, decimal or an unsigned of those.
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}