473,513 Members | 2,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# 4.0 language features

An "official" document covering the new language features has finally
been posted:

http://code.msdn.microsoft.com/cshar...ReleaseId=1686

(warning: it's available in .docx format only)

Not that much, to be honest. Named arguments is the only feature that
is likely to be used, and, while certainly nice to have in and of
itself, it really is long overdue (as Anders himself said on PDC). The
rest seem to be too specialized, though I can think of some ways to
creatively abuse IDynamicObject and dynamic dispatch to e.g. walk XML
trees, XPath-style (similar to first-class LINQ to XML support in
VB9).

Your thoughts?
Oct 28 '08 #1
3 1942
I can see "dynamic" type being abused a lot by VB developers. It's like
"Object" in VB6
"Pavel Minaev" <in****@gmail.comwrote in message
news:7e**********************************@m3g2000h sc.googlegroups.com...
An "official" document covering the new language features has finally
been posted:

http://code.msdn.microsoft.com/cshar...ReleaseId=1686

(warning: it's available in .docx format only)

Not that much, to be honest. Named arguments is the only feature that
is likely to be used, and, while certainly nice to have in and of
itself, it really is long overdue (as Anders himself said on PDC). The
rest seem to be too specialized, though I can think of some ways to
creatively abuse IDynamicObject and dynamic dispatch to e.g. walk XML
trees, XPath-style (similar to first-class LINQ to XML support in
VB9).

Your thoughts?
Oct 28 '08 #2
I also expect to see much great take up of COM interop with this version.

I am greatly looking forward to avoiding this as much as possible :-)

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com
Oct 28 '08 #3
After some discussion of new C# 4.0 features with Eric Lippert, it
seems that dynamic is not quite as obvious as it seems, and can be
abused in some rather creative ways. It's not just a dynamic receiver
that triggers dynamic dispatch - it's _any_ argument that's dynamic.
But, in this case, the arguments (including the receiver) that are
statically typed are used to constrain the candidate method group at
run-time. For example:

class Base
{
public void Foo(int i) {}
public virtual void Foo(float f) {}
}

class Derived : Base
{
public override void Foo(float f) {}
public new void Foo(string s) {}
}

Base b = new Derived();
object arg = 1; // hide actual type at compile-time
b.Foo((dynamic)arg); // calls Base.Foo(int) - overload resolution at
runtime
arg = 1.2f;
b.Foo((dynamic)arg); // calls Derived.Foo(float) - overload
resolution at runtime yields Base.Foo(float) + virtual/override
dispatch as usual
arg = "abc";
b.Foo((dybamic)arg); // does NOT call Derived.Foo(string), since
variable b is declared as Base; runtime exception!

This is interesting. We've all seen those clever LINQ hacks (monads
etc); now the challenge of the day is to find some way to abuse
dynamic in a similarly non-obvious fashion ;)
Oct 30 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2032
by: 5460lqh | last post by:
who can tell me which two features in the C++ language are most usefule, and which two features that you think are the most over-rated or the most misused and why you think so? Thanks very much!
22
2836
by: Michael Nahas | last post by:
Antti & all interested, The draft description of my language to replace C is available at: http://nahas.is-a-geek.com/~mike/MyC.pdf I am a long time C programmer (I read the old testament...
7
3123
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
7
3277
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with...
6
2101
by: Sean | last post by:
Hi, guys: I am newbie to the C++ from the C. I want to know something about the C++ language features! Could you describe your two favorite features in the C++ language and why you like them so...
669
25404
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
1
2069
by: Petr Prikryl | last post by:
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules...
11
3153
by: Sarath | last post by:
I'm so much font of working with C++ . That's the reason why I'm not yet looked or craze about any other language. Still a question exists, really C++ is the best language in its category?
84
8493
by: aarklon | last post by:
Hi all, I found an interesting article here:- http://en.wikipedia.org/wiki/Criticism_of_the_C_programming_language well what do you guys think of this article....??? Is it constructive...
43
3618
by: Adem24 | last post by:
The World Joint Programming Language Standardization Committe (WJPLSC) hereby proclaims to the people of the world that a new programming language is needed for the benefit of the whole mankind in...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.