Browse by Tags

Tagged Content List
  • Blog Post: Why does C# always use callvirt? - followup

    I was responding in comments, but it doesn't allow me to use links, so here's the long version: Judah, Yes, marking everything as virtual would have little performance impact. It would, however, be a Bad Thing . It's #3 on my list of deadly sins... ShayEr, cmp [exc], exc is the solution to...
  • Blog Post: Updated version of my book coming...

    In the spring before C# was first disclosed, I ended up, through a curious juxtaposition of events, writing a book on C# named " A Programmer's Introduction to C# " This probably rates second on the list of "cool things I got to do while I was on the C# team" (being on the language design team probably...
  • Blog Post: What's with those "break" statements?

    One comment from my recent post was big enough to handle separately... Thomas wrote : I'll second the break statement. Why is it really necessary? Haven't you guys got enough feedback to acknowledge that wasn't the brightest move? You say it is there to please the C++ developers, because they are your...
  • Blog Post: x+=x++;

    Luca , who is taking over for me as C# Compiler PM, wrote this post: x+=x++; I heartily agree with him when he says "DO NOT WRITE THAT CODE".
  • Blog Post: Be a language designer redux...

    Thanks for all the responses to the question that I posed. The reason I posed it is that I've been seeing a lot of language requests coming through the MSDN feedback site, which is a good thing, but some of them are pretty obviously impractical, so I wanted to try to explore a little of the "language...
  • Blog Post: Be a language designer...

    I started writing a normal blog post - well, as normal as any blog post of mine ever is - and then I decided to let you do the hard work. So here's the situation. You're part of the C# language design team thinking about the next version of C# (ie the version after VS 2005). You get the following email...
  • Blog Post: Conditional Attributes

    There's an extension to the conditional concept that shows up in Whidbey. It's not in Beta1 (well, to be more correct, it doesn't really work in beta 1), but it will be functional in beta2. If you put a conditional attribute on an attribute definition, that instructs the compiler to only place that attribute...
  • Blog Post: Conditional Methods

    I saw an internal post today about somebody who wanted to get rid of their #if DEBUG statements in their code, because they were ugly. That made me realize that there's a feature that not everybody knows about, known as conditional methods. Consider the following code: using System; using System.Diagnostics;...
  • Blog Post: Arrays inside of structures

    Sometimes when doing interop, you want to have an array embedded inside of a struct. For example, something like: struct data { int header; int values[10]; } that you either used in a call to interop, or with unsafe code to deal with an existing format - something like a network packet or a disk record...
  • Blog Post: Nested Using Statements

    I got a comment on the language feature post, asking about an easier way to write: using (StreamWriter w1 = File.CreateText("W1")) { using (StreamWriter w2 = File.CreateText("W2")) { // code here } } You can do this by writing: using (StreamWriter w1 = File.CreateText("W1")) using (StreamWriter...
  • Blog Post: TechEd Whiteboard with Anders

    At TechEd 2004, Anders did a whiteboard talk . Recommended. (From Dan )
  • Blog Post: using - It's not just for memory management

    When we designed the using statement waaaay back in the first version of C#, we decided to call it using because we thought it had other purposes outside of the usual use: using (StreamWriter writer = File.CreateText(”blah.txt”)) { ... } Today I was responding to a customer suggestion...
  • Blog Post: Anders Hejlsberg - Programming data in C# 3.0 #

    Dan pointed me to a new video on Channel9 about some of the things we're talking about for C# 3.0
  • Blog Post: Poser: What is the lifetime of local instances?

    A reader wote me to ask a question about variable lifetimes. Consider the following code: class Mutex { public Mutex(string name) { hMutex = Kernel32.CreateMutex(null,false,name); Kernel32.WaitForSingleObject(hMutex,0); } ~Mutex() { Kernel32.ReleaseMutex(hMutex); } } class MyClass { void MyFunc() { Mutex...
  • Blog Post: Why language features die, and language extensibility

    Rick Byers wrote (some time ago): Thanks for the awesome post Eric. I'd be interested in hearing more detail about the sorts of things that cause features to be rejected. Is it common to reject a feature that you think would be valuable only because of syntactic compatibility limitations (parser ambiguity...
  • Blog Post: Future language features & scenarios

    We're starting to think about the release after Whidbey in the C# compiler team. I know that it seems strange that we have just shipped the Whidbey beta, and we're already talking about what comes next, but we're fairly close to being “shut down” for the compiler right now. So, we're taking...
  • Blog Post: Fixed statement and null input...

    I'd like some input on a change we're considering for Whidbey. Consider the following wrapper class: unsafe class Wrapper { public void ManagedFunc(byte[] data) { fixed (byte* pData = data) { UnmanagedFunc(pData); } } void UnmanagedFunc(byte* pData) } } In this class, I've fixed a byte[]...
  • Blog Post: Extending existing classes

    One other point that came up in the static import thread was extending existing classes. It's not uncommon to want to add specific methods to existing classes - or at least have the appearance of doing this. For example, I might want to add a new method to the string class, so I can call it with: ...
  • Blog Post: Taken to task on my static import post...

    Darren took me to task on my post on static import . Despite the fact that he said, “ I code in patterns and in english... the syntax of the language is an afterthought! If you don't at least tolerate those assertions, don't bother reading the rest of the post ..“, I did read the rest...
  • Blog Post: Why static import is bad...

    John Rusk asked me to elaborate on why I think static import is bad. It's all about readability. Most people agree that the average line of source code is read far more times than it is written, which means that being able to understand the line is more important than being able to write it quickly...
  • Blog Post: More on AOP scenarios

    The big scenario that always comes up WRT AOP programming is logging. I agree that that whole feature space - which I'll lump into the “instrumentation” bucket - is a good scenario, though AOP is obviously not the only the way to approach it. What are the other scenarios? If you can give...
  • Blog Post: C# and Aspect Oriented Programming

    One common question I've heard recently is “Are there any plans to add AOP support to C#?” We don't currently have any plans to add AOP into the language. My current thinking - and I'm not speaking for the whole design team now, though I think my position is at least somewhat representative...
  • Blog Post: Whiteboard with Anders session

    (Turns out we got a bad video file for this, so the session isn't up right now. I'll repost when it is fixed) During TechEd, there was a Cabana session titled “Whiteboard with Anders”, in which Anders got up in front of a whiteboard and fielded questions from the attendees. Great...
  • Blog Post: How an idea becomes a C# language feature?

    In a recent email, a customer asked for a delegation feature. He wanted to do something like (purely theoretical syntax): class MyClass: ITest { MyHelperObject o: ITest; } so that he could delegate the implementation of the interface to a helper object, and have the compiler automatically generate...
  • Blog Post: The Difficulties of Language Design

    Phil Haack writes about the difficulties of language design . And no, I'm not linking just because he mentions me twice...
Page 1 of 3 (74 items) 123