Welcome to MSDN Blogs
Sign in
|
Join
|
Help
Eric Gunnerson's C# Compendium
This Blog
Email
Syndication
RSS 2.0
Atom 1.0
Search
Go
General
Suggest a Topic
The C# FAQ
Eric's C# Book
So you want to write a computer book...
Tags
Agile
Avalon
Books
Column
CrackedRib
CSharp
Cycling
electronics
Friends
Fun
HealthVault
Humorish
Language
Photography
Program Manager
Programming
Regex 101
Review
Vista
What's Wrong With This Code
Windows DVD Maker
Windows Movie Maker
WPF
XNA
Recent Posts
Holiday light project 2008...
Brilliant...
What's going on now...
Scary...
wireless LCD photo frame...
Archives
November 2008 (4)
October 2008 (3)
September 2008 (3)
August 2008 (3)
July 2008 (8)
June 2008 (5)
May 2008 (2)
April 2008 (3)
March 2008 (7)
February 2008 (3)
January 2008 (7)
December 2007 (7)
November 2007 (14)
October 2007 (19)
September 2007 (3)
August 2007 (4)
July 2007 (9)
June 2007 (15)
May 2007 (9)
April 2007 (8)
March 2007 (13)
February 2007 (6)
January 2007 (8)
December 2006 (7)
November 2006 (3)
October 2006 (13)
September 2006 (13)
August 2006 (11)
July 2006 (8)
June 2006 (12)
May 2006 (16)
April 2006 (21)
March 2006 (26)
February 2006 (22)
January 2006 (26)
December 2005 (21)
November 2005 (23)
October 2005 (17)
September 2005 (23)
August 2005 (16)
July 2005 (14)
June 2005 (20)
May 2005 (21)
April 2005 (29)
March 2005 (29)
February 2005 (16)
January 2005 (25)
December 2004 (17)
November 2004 (20)
October 2004 (19)
September 2004 (26)
August 2004 (40)
July 2004 (31)
June 2004 (38)
May 2004 (24)
April 2004 (39)
March 2004 (27)
February 2004 (32)
January 2004 (24)
December 2003 (17)
November 2003 (17)
October 2003 (23)
September 2003 (25)
August 2003 (15)
July 2003 (25)
June 2003 (5)
March 2004 - Posts
Wednesday, March 31, 2004 10:30 PM
Work/Life Balance
Every year, Microsoft does a widespread poll to determine how people view their work environment, their compensation, etc. One of the questions is something like, “Are you satisfied with your work-life balance?” That tends to be a sore topic
Posted by
ericgu
|
7 Comments
Filed under:
Program Manager
Wednesday, March 31, 2004 8:52 PM
Particular boats and Funicular goats
Your task: 1) Figure out what this reference is 2) Figure out why it's an appropriate one
Posted by
ericgu
|
9 Comments
Sunday, March 28, 2004 8:52 PM
Using for purposes other than disposable objects...
Doug asks : re: A lock statement with timeout... I've done this trick before to deal with common patterns in numerous methods. Usually lock acquisition, but there are some others. Problem is it always feels like a hack since the object isn't really disposable
Posted by
ericgu
|
4 Comments
Filed under:
Language
,
CSharp
Sunday, March 28, 2004 8:35 PM
Enumerators and boxing..
Jeroen asked : While we're on the subject of boxing, why doesn't foreach do the same optimization as using? foreach always seems to box the enumerator struct. If you use a struct as an enumerator, you will always box when you go to IEnumerator. Interfaces
Posted by
ericgu
|
3 Comments
Filed under:
Language
,
CSharp
Wednesday, March 24, 2004 9:22 PM
A lock statement with timeout...
Ian Griffiths comes up with an interesting way to use IDisposable and the “using“ statement to get a very of lock with timeout. I like the approach, but there are two ways to improve it: 1) Define TimedLock as a struct instead of a class,
Posted by
ericgu
|
25 Comments
Filed under:
CSharp
,
Programming
Wednesday, March 24, 2004 9:01 PM
C# Featurette #1 - Reference and Value type Constraints
We've spent a lot of time talking about the major features of the C# language, but there are a number of minor features that we've added that we haven't talked about. As we march towards our Beta release (and we make bits available ), I'm going to start
Posted by
ericgu
|
23 Comments
Filed under:
Language
,
CSharp
Tuesday, March 23, 2004 8:32 PM
Adding Emptiness to the DateTime class
I got an interesting email from a customer today, asking for my opinion on how to deal with the concept of “Empty” in relation to DateTime values. They had decided to use the DateTime.MinValue value as an indication that the DateTime was empty.
Posted by
ericgu
|
29 Comments
Filed under:
CSharp
,
Programming
Friday, March 19, 2004 1:27 PM
Speed of direct calls vs interfaces vs delegates vs virtuals
I've gotten a couple of follow-up questions on my column on dynamic dispatch asking why there are differences between direct calls, interface calls, virtual calls, and delegate calls. I'm not Jan or Rico , who know a lot more about these topics than I
Posted by
ericgu
|
6 Comments
Filed under:
CSharp
,
Programming
Thursday, March 18, 2004 4:20 PM
Arrays with non-zero upper and lower bounds...
In the comments to my post on zero and one based arrays, several people mentioned that they wanted to be able to have collections that ran from 4 to 10, or from 1900 to 2004 for years. Consider the following: public class YearClass { const int StartDate
Posted by
ericgu
|
11 Comments
Filed under:
Language
,
CSharp
,
Programming
Thursday, March 18, 2004 1:41 PM
Timing your C# code
I've gotten a couple of emails on my recent column telling me that they couldn't replicate my timings. My first reaction was a sinking feeling in my stomach that I'd messed up the timings, but then a more rational idea occurred to me. They were running
Posted by
ericgu
|
6 Comments
Filed under:
CSharp
,
Programming
Thursday, March 18, 2004 1:30 PM
What's wrong with this code redux...
Thanks to all for their comments on “what's wrong with this code”. I will confess to making a tactical error in presenting the code. I started only showing a single error, and then I went back and showed another one. Ones that people commented
Posted by
ericgu
|
3 Comments
Filed under:
Language
Tuesday, March 16, 2004 9:06 PM
Who does Microsoft talk to when they have questions?
In the comments to my “What's coming up in C# beyond Whidbey”, RichB makes the following comment: I sometimes wonder who Microsoft ask for these opinions. I suspect it's internal Microsoft developers and Wintellect/DevelopMentor trainers.
Posted by
ericgu
|
22 Comments
Filed under:
CSharp
Tuesday, March 16, 2004 2:55 PM
zero or one based collection?
moo asks: Zero based collections or 1 based? Since programming languages are a bridge between the human concept of a solution and we naturally think the first element is in position 1, why was this not so on the actual language? Why are we made to think
Posted by
ericgu
|
42 Comments
Filed under:
Language
,
CSharp
,
Programming
Tuesday, March 16, 2004 2:32 PM
What's wrong with this code?
TechEd is rapidly approaching, and I'm signed up to do a “C# Best Practices” kind of talk. Rather bore my audience by presenting my views on implementing IDisposable, I'm going to take the “What's wrong with this code?” approach.
Posted by
ericgu
|
36 Comments
Filed under:
Language
,
CSharp
,
Programming
Tuesday, March 16, 2004 11:08 AM
Performance Quiz
Rico presents a very interesting performance quiz on writing string values:
Posted by
ericgu
|
2 Comments
Filed under:
CSharp
,
Programming
Tuesday, March 16, 2004 11:02 AM
C# and Unit Testing chat on Thursday
Jim Newkirk, one of the authors of NUnit and lately of the Microsoft PAG group, will be joining the C# team in a chat on C# and Unit Testing this Thursday . Jim has a book entitled Test Driven Development in Microsoft Net on the way. He's also a co-author
Posted by
ericgu
|
0 Comments
Filed under:
CSharp
,
Programming
Tuesday, March 16, 2004 10:57 AM
Anson talks about implementing interfaces in the IDE in Whidbey
Anson talks about implementing interfaces in the IDE in Whidbey. Anson is the PM who used to own the C# compiler, and now owns the C# IDE (primarily the things the C# team builds - Intellisense, expansions, etc. - but he watches over the rest of the IDE
Posted by
ericgu
|
1 Comments
Filed under:
CSharp
Friday, March 12, 2004 9:48 AM
Commenters: Please ask off-topic questions on my "Suggest a topic" link
I really appreciate the comments that people leave on my posts, and the comments are often more valuable than the posts themselves. However, every day or so, I'll get an off-topic question. For example, in my post talking about what's coming up in Whidbey,
Posted by
ericgu
|
6 Comments
Thursday, March 11, 2004 9:34 PM
What's coming up for C# beyond Whidbey?
Diego asks, Now that C# 2.0 is almost here, I'd like to know about features that were left out from this release and planned for the future? I can't think of anything that I'd say was “left out“. There are a few things that we've been talking
Posted by
ericgu
|
12 Comments
Filed under:
Language
,
CSharp
Thursday, March 11, 2004 9:17 PM
Why do delegate arguments have to match exactly?
Michael asks, Why do delegate arguments have to match exactly, when creating a delegate using Delegate.CreateDelegate? Example: delegate void SpecialEventHandler(object sender, SpecialEventArgs e); Handler function: void SpecialMethod(object sender, EventArgs
Posted by
ericgu
|
3 Comments
Filed under:
Language
,
CSharp
Thursday, March 11, 2004 8:53 PM
The virtues of "One Note"
Derek said that I should write about the virtues of OneNote, which is, in his words, “one sweet app...” I've been using it off and on, and while I think it's a nice too, it has a few drawbacks for the kind of notes I do. For the C# language
Posted by
ericgu
|
2 Comments
Thursday, March 11, 2004 8:47 PM
Fewer blog posts here, more on the C# FAQ
I've decided that rather than put FAQ answers here, I'm going to put them on the C# FAQ instead. That will allow us to keep all the good answers together in one place. I haven't been linking to them from here, but I could if people would find that useful.
Posted by
ericgu
|
2 Comments
Thursday, March 11, 2004 8:47 PM
Bruce Eckel - Generics Aren't
Bruce has an interesting discussion entitled “ Generics Aren't ”. It's primarily about the new support for generics in Java, but it has a lot of “generic generic” material as well.
Posted by
ericgu
|
3 Comments
Filed under:
Programming
Tuesday, March 09, 2004 8:52 PM
The VS7 debugger doesn't work. What can I do?
Min provides a new link to his excellent document on debugging the debugger.
Posted by
ericgu
|
2 Comments
Sunday, March 07, 2004 12:42 PM
Why doesn't C# support default parameters?
A post in the new C# FAQ Blog. The items will be showing up on the C# dev center in the near future.
Posted by
ericgu
|
1 Comments
Filed under:
Language
,
CSharp
Tuesday, March 02, 2004 7:22 PM
New Column - different methods of dynamic dispatch.
My most recent column went live on MSDN today. It discusses different methods of dynamic execution of code. Executive summary: Avoid Type.InvokeMember() if you can. [Update: One of my readers sent me an article with some additional timings]
Posted by
ericgu
|
20 Comments
Filed under:
Language
Monday, March 01, 2004 4:48 PM
Why does C# require 'ref' and 'out' at both definition and use?
(question from a customer) If you use 'ref' or 'out' on a method parameter: class Test { public void Process(ref int t) { ... } } when you call it you need to specify 'ref': Test t = new Test(); int val = 5; t.Process(ref val); We require you to include
Posted by
ericgu
|
15 Comments
Filed under:
Language
,
CSharp