Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 20th, 2008, 9:51 AM   #1
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovė/Prishtinė
Posts: 47
Rep Power: 0 milot is on a distinguished road
C# 3.0

Hi guys,

Long time no post, I was busy studying and working in the same time so I didn't have time to join the forums. But now I found some time to share my experience on C# 3.0 with C# developers here.

Lately I started using new features which was introduced in C# 3.0 that are part of .NET Framework 3.5 and I was amazed by its features! I would like to know that if anybody here in the forums started using C# 3.0 yet?

I'm expecting questions and/or discussion about this topic
milot is offline   Reply With Quote
Old May 20th, 2008, 12:40 PM   #2
Druid
Programmer
 
Join Date: Mar 2006
Posts: 40
Rep Power: 0 Druid is on a distinguished road
Re: C# 3.0

What features of C# 3.0 and .NET 3.5 have you been using ? I personally, haven't used any.
Druid is offline   Reply With Quote
Old May 20th, 2008, 10:50 PM   #3
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
Re: C# 3.0

LINQ is pretty cool, but I haven't used it much. In terms of ASP.NET, 3.5 brought a bunch of stuff with it, especially related to AJAX.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote
Old May 21st, 2008, 7:30 AM   #4
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovė/Prishtinė
Posts: 47
Rep Power: 0 milot is on a distinguished road
Re: C# 3.0

Druid,

I started using anonymous types, extension methods, LINQ, new object initialization feature, lambda expressions instead of anonymous method delegate calls, the beautiful var keyword etc. If you want some code samples I will show you, or you can perform a simple google search and find tons of materials on the net.

Jimbo,

LINQ is awsome, I am using it against any object which implements IEnumerable<t> even if I have some legacy collections such as ArrayList I use LINQ against it using .OfType<T> operator to cast it to IEnumerable<T> object.
milot is offline   Reply With Quote
Old May 21st, 2008, 1:50 PM   #5
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
Re: C# 3.0

>I would like to know that if anybody here in the forums started using C# 3.0 yet?
Yup.

>the beautiful var keyword
I get the sense that you're quite partial to this new feature. Would you mind explaining why? My impression is that implicitly typed variables are extremely easy to misuse and in many cases result in less transparent code. I suppose a more specific question would be what kind of guidelines are you using for when to implicitly type a variable and when to explicitly state the type?
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote
Old May 21st, 2008, 11:12 PM   #6
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Re: C# 3.0

The var keyword is mandatory when you have an anonymous type and you go

csharp Syntax (Toggle Plain Text)
  1. var person = new {Name="asdf",Age=1};

And I also use it for stuff like declaring :

csharp Syntax (Toggle Plain Text)
  1. Dictionary<int,IList<NewObject>> dictionary = new .....

Using var in this case is really a blessing
In other cases I tend not to use it. But then again I haven't been doing too much 3.5
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old May 21st, 2008, 11:51 PM   #7
BstrucT
Hobbyist Programmer
 
BstrucT's Avatar
 
Join Date: Dec 2007
Location: Durban, South-Africa
Posts: 194
Rep Power: 1 BstrucT is on a distinguished road
Re: C# 3.0

I take it one can only use 3.5 with MS Visual C# 2008?
__________________
Be kinder than necessary because everyone you meet is fighting some kind of battle.
BstrucT is offline   Reply With Quote
Old May 21st, 2008, 11:52 PM   #8
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
Re: C# 3.0

I'm torn on the var syntax. On the one hand, it's weird in C# to declare a variable without explicitly declaring it's type. On the other hand, it's quite handy to use VB-ish syntax to give the variable a type without having to specify the type twice. Example:
// C# 2.0
Dictionary<String, String> foo = new Dictionary<String, String>();
// C# 3.0
var foo = new Dictionary<String, String>();
// VB
Dim foo As New Dictionary(Of String, String)
Then again, the typical LINQ usage of var is var foo = <some query returning who knows what type> so I can see why it can be controversial.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote
Old May 22nd, 2008, 1:28 AM   #9
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Re: C# 3.0

Quote:
Originally Posted by BstrucT View Post
I take it one can only use 3.5 with MS Visual C# 2008?
Pretty much so.
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old May 22nd, 2008, 2:23 AM   #10
BstrucT
Hobbyist Programmer
 
BstrucT's Avatar
 
Join Date: Dec 2007
Location: Durban, South-Africa
Posts: 194
Rep Power: 1 BstrucT is on a distinguished road
Re: C# 3.0

Thanks.
__________________
Be kinder than necessary because everyone you meet is fighting some kind of battle.
BstrucT is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC