Welcome to MSDN Blogs Sign in | Join | Help

March 2004 - Posts

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:

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

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: ,

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: ,

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: ,

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: ,

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: ,

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: ,

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: , ,

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: ,

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:

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:

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: , ,

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: , ,

Performance Quiz

Rico presents a very interesting performance quiz on writing string values:
Posted by ericgu | 2 Comments
Filed under: ,

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: ,

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:

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

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: ,

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: ,

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

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

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:

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

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: ,

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:

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: ,
 
Page view tracker