Browse by Tags

Tagged Content List
  • Blog Post: Is C# a strongly typed or a weakly typed language?

    Presented as a dialogue, as is my wont! Is C# a strongly typed or a weakly typed language? Yes. That is unhelpful. I don't doubt it. Interestingly, if you rephrased the question as an "and" question, the answer would be the same. What? You mean, is C# a strongly typed and a weakly typed...
  • Blog Post: Foolish consistency is foolish

    Once again today's posting is presented as a dialogue, as is my wont. Why is var sometimes required on an implicitly-typed local variable and sometimes illegal on an implicitly typed local variable? That's a good question but can you make it more precise? Start by listing the situations in which an implicitly...
  • Blog Post: What would Feynman do?

    No one I know at Microsoft asks those godawful "lateral-thinking puzzle" interview questions anymore. Maybe someone still does, I don't know. But rumour has it that a lot of companies are still following the Microsoft lead from the 1990s in their interviews. In that tradition, I present a sequel to Keith...
  • Blog Post: Ambiguous Optional Parentheses, Part One

    (This is part one of a three-part series on C# language design issues involving elided parentheses in constructor calls. Part two is here .) Another amusing question from StackOverflow , which I present here as a dialogue, as is my wont: In C# 3.0 the object initializer (and collection initializer...
  • Blog Post: Don't repeat yourself; consts are already static

    Today, another entertaining question from StackOverflow . Presented again as a dialogue, as is my wont. The specification says " even though constants are considered static members, a constant-declaration neither requires nor allows a static modifier ." Why was the decision made to not force constants...
  • Blog Post: What’s the difference between a destructor and a finalizer?

    Today, another dialogue, and another episode of my ongoing series "what's the difference?" What’s the difference, if any, between a “destructor” and a “finalizer”? Both are mechanisms for cleaning up a resource when it is no longer in use. When I was asked this, at first I didn’t think there was...
  • Blog Post: Simple names are not so simple, Part Two, plus, volcanoes and fried foods

    I've returned from a brief vacation, visiting friends on the island of Maui. I'd never been to that part of the world before. Turns out, it's a small island in the middle of the Pacific Ocean, entirely made out of volcanoes. Weird! But delightful. The most impressive thing about the Hawaiian Islands...
  • Blog Post: As Timeless As Infinity

    User: Recently I found out about a peculiar behaviour concerning division by zero in floating point numbers in C#. It does not throw an exception, as with integer division, but rather returns an "infinity". Why is that? Eric: As I've often said, "why" questions are difficult for me to answer. My first...
  • Blog Post: What's the difference between conditional compilation and the conditional attribute?

    User : Why does this program not compile correctly in the release build? class Program { #if DEBUG static int testCounter = 0; #endif static void Main(string[] args) { SomeTestMethod(testCounter++); } [Conditional("DEBUG")] static void SomeTestMethod(int t) { } } Eric : This fails to compile in...
  • Blog Post: The correct answer is "no"

    No technology today. I have not done a post on relationship advice in ages! Compare and contrast these two conversations: ****** Version One: Alice : Thanks for having lunch with me. I suppose you know what I want to talk about. Eric : Yeah, I do. I think you shouldn't jump to conclusions...
  • Blog Post: In Foof We Trust: A Dialogue

    User : The typeof(T) operator in C# essentially means “compiler, generate some code that gives me an object at runtime which represents the type you associate with the name T”. It would be nice to have similar operators that could take names of, say, methods and give you other metadata objects, like...
  • Blog Post: A Book By Any Other Name Would Smell As Sweet

    As you might have gathered from my previous posts on the subject, I occasionally edit technical books as a hobby. It’s nice having a hobby that pays money instead of costing money. And I always learn something from every book. Many years ago, on one of my first editing gigs, the editor asked me my...
  • Blog Post: Preventing third-party derivation, part one

    In this episode of FAIC, a conversation I had with a C# user recently. Next time, some further thoughts on how to use the CLR security system in this sort of scenario. Him: I have this abstract class defined in one assembly: // Assembly FooBar.DLL public abstract class Foo { internal abstract void...
  • Blog Post: Method Hiding Apologia

    Here's some back-and-forth from an email conversation I had with a user a while back. Why should one avoid method hiding? If there were no advantages and only disadvantages then we would not have added it to the language in the first place. C# implements hiding because hiding is frequently useful...
  • Blog Post: I Have A Mysterious Fifth Sense

    A little fun for a Friday afternoon. The economy must be picking up -- I'm getting cold calls from recruiters again for the first time in about four years. Today was the second (and third!) this month. However, apparently some of them are just a wee bit disorganized. I just had the following conversations...
  • Blog Post: What are the VBScript reference semantics for object members?

    Clearly in order for VBScript to support variable referencing there has to be a variable to reference.   Consider our earlier example:   Sub Change(ByRef XYZ)    XYZ = 5 End Sub Dim ABC ABC = 123 Change ABC ...
Page 1 of 1 (16 items)