Amazon.com Widgets April, 2003 - Brad Abrams - Site Home - MSDN Blogs

Brad Abrams

Design Guidelines, Managed code and the .NET Framework

April, 2003

  • Brad Abrams

    String.Empty vs ""

    • 17 Comments
    As David implies , there difference between String.Empty and “” are pretty small, but there is a difference. “” actually creates an object, it will likely be pulled out of the string intern pool, but still… while String.Empty creates no object… so...
  • Brad Abrams

    Implementing ICloneable

    • 10 Comments
    I was doing a little work on the Design Guidelines document tonight and I noticed this section that we added recently. I thought I'd post it here for your comments. Where are you using ICloneable today? Do you agree with this suggestion? 1...
  • Brad Abrams

    Assembly/DLL Naming Guidelines

    • 6 Comments
    I have not seen this be much of debate externally, but it has been pretty hotly debated internally. We just closed down on this guideline... As always, your comments are welcome: 2.3.4 Assembly/DLL Naming Guidelines An assembly is the...
  • Brad Abrams

    Implementing IEnumerable

    • 6 Comments
    Hot off the presses... What do you think? ..brad Implementing IEnumerable Almost all collections expose some way to enumerate elements it contains. The IEnumerable interface encapsulates this notion such that common facilities can be built...
  • Brad Abrams

    Use of AppDomain.Load()

    • 5 Comments
    More from inside the walls.. From the dev that owns the loader... AppDomain.Load() is only meant to be called on the current AppDomain (for use by Interop callers). If you call it on a different AppDomain, if the assembly successfully loads in the...
  • Brad Abrams

    fxcop command line example

    • 1 Comments
    I noticed someone hit my site from a google search on this topic. My guess is they didn't find out what they needed, so I thought i'd post a complete answer just in case someone else comes looking for it.. From Michael Fanning the Dev lead for FxCop...
  • Brad Abrams

    DateTimeFormating

    • 1 Comments
    Well, with a lead in like that I could not help but post. This sample comes from a f riend of mine working who is helping me with a little book project... using System; using System.Globalization; namespace Samples { public class DateTimeFormatInfoSample...
  • Brad Abrams

    path to the executable

    • 2 Comments
    Another one that I have seen come up before... Q: How to find that path to the executable I am running in? A: Assembly.GetExecutingAssembly().Location
  • Brad Abrams

    Retrieving the Fusion log

    • 2 Comments
    More from the dev that owns the loader... If the exception message isn’t enough for you to determine what the problem is, try getting the Fusion log. It will describe the binding failure (if this is due to an assembly binding failure, instead...
  • Brad Abrams

    Quick C# Quiz

    • 7 Comments
    Will this code throw an AgrumentNullException? and why? string firstName = null; String.Format (“{0}”, firstName); Here is the for code String.Format , if that helps… public static String Format(String format, Object arg0) { return...
  • Brad Abrams

    Memory Leaks in Managed code

    • 3 Comments
    Q: Can you have memory leaks in managed code? If so, how can you catch them? A: (From the GC Architect) GC will typically reclaim objects at its own pace, based on balancing available memory and runtime overhead. If an assembly is terminated and...
  • Brad Abrams

    Hashtable.Clear thread-safety?

    • 1 Comments
    Q: Is it safe for a single writer to call Hashtable.Clear() with multiple concurrent readers? A: (from the developer that owns Hashtable) It depends on what you want. Clear() will not cause a hashtable to be inconsistent state, so hashtable will...
  • Brad Abrams

    On System.Enum and System.ValueType

    • 2 Comments
    Yup Shawn has it pretty much right on . Both System.Enum and System.ValueType are themselves reference types. We added them to the system for two primary reasons: 1. We wanted to provide developers an easy way to group all ValueTypes and all...
  • Brad Abrams

    More on String.Empty

    • 4 Comments
    Deepak Sharma asks : Where does String.Length == 0 stands in terms of memory efficiency compared to these two methods? Any ideas. I chatted with the Dev lead that owns String… here is his response: Actually, there is no memory effect here...
  • Brad Abrams

    Get the hresult from a managed exception

    • 0 Comments
    This comes up a lot on internal lists so I thought i'd share... from the FAQ: G et the hresult by calling System.Runtime.InteropServices.Marshal.GetHRForException() on the Exception object. If that info is not readily available, you may need to...
  • Brad Abrams

    Strings and IsNullOrEmpty

    • 8 Comments
    Jesse aks: >Tired of doing this: "if(s == null || s == String.Empty)"... Yea, we have heard that request before... here is a method we are looking at adding a the Whidbey release of the .NET Framework on the System.String class. ...
  • Brad Abrams

    Are assignment of 4-byte quantities guaranteed atomic in the CLR?

    • 6 Comments
    We had a little thread on this internally today and I thought it interesting enough to share here. I am just experimenting here – is this type of thing useful? Q: If I do simple Int32 assignment to a shared variable in a CLR multi-threaded app,...
  • Brad Abrams

    More on BCL type names

    • 3 Comments
    Jeff read my recent post and suggested I include ALL his reasons for using the BCL name... Here are they are... 1. Devs think there is a difference between String and string or int and Int32 and there isn’t. For example, I’ve run into some people...
  • Brad Abrams

    Why Blog

    • 4 Comments
    Why Blog they ask… I believe that Microsoft has benefited greatly from the enormous community support that is available for the .NET Framework. I have been thinking for a while about how I can best contribute to that community. I spend some time...
  • Brad Abrams

    Space Invaders Screen Shot

    • 0 Comments
    Chris asks for a picture… finally got it … Long live command line apps!
  • Brad Abrams

    Why Strong Naming?

    • 2 Comments
    More from inside the walls: Q: Does anyone know why we’ve created two ways to sign the components? The certificate form covers all the needs I can see. I wonder why we have a separate “strong naming” manner to do signing that doesn’t cover all the...
  • Brad Abrams

    Who's got the locks?

    • 1 Comments
    I just had a little fun playing around with SOS today... Here is a bit of mail from a dev on the CLR debugger team that makes this magic happen. If you are running V1.1 then you can use the SOS.dll that is in the Framework\v1.1.4322 folder under...
  • Brad Abrams

    Did a short MSDN TV Spot today...

    • 6 Comments
    Erica Wiechers from the .NET Show fame came by my office today and shot a short segment for MSDN TV about how the GC works and the Dispose pattern . I thought it went fairly well. I was impressed at how quick it went, it was so easy to get it scheduled...
  • Brad Abrams

    AppDomains for sandboxing/robustness

    • 2 Comments
    Another internal thread I thought i'd share... Q: I want to sandbox objects of certain types that will be running in my process so that if anything in these objects crashes for any reason, code in the other objects continue to execute. I’m assuming...
  • Brad Abrams

    Conversion Operators

    • 3 Comments
    One of my many jobs here at MS is helping out with the .NET Framework Design Guidelines Document. Tonight I had to make a small tweak to a guideline I added last week so I thought while I was in there I would post it here to see if folks had comments...
Page 1 of 2 (50 items) 12