What if we gave you $100 to spend? [Krzysztof Cwalina]

The BCL team is starting to plan our next release. Is there any base API that if you’d heard we were working on you’d say “I can’t wait to get the next version of the Framework”? Any basic data structures? Any Win32 functionality that we don’t currently expose in the Framework and you can’t live without? Any APIs that other frameworks have and you miss them in the .NET Framework?


Tell us how you would distribute hypothetical $100 to fund the features. For example, this is what I would do if my car manufacturer asked me this question:

  1. The ability to wirelessly upload music to the car’s stereo system ($60)

  2. More torque ($30)

  3. Beep when I lock the car ($5)

  4. Larger trunk ($5)

Comments (37)

  1. Kristoffer says:

    I’d love a good generic collection that I can use to derive my own custom collection implementations from. The current System.Collections.ObjectModel.Collection<> lacks several important functions such as sorting and single entry point adds and deletes (to verify non null entries or to set ownership for example).

  2. Geoff Van Brunt says:

    How about unloadable dlls… I know you can kludge it by using appdomains, but why can’t a dll "garbage collector" be created. After you unload a dll, the "garbage collector" will unload it as soon as no more objects created from classes in it loaded. Of course there is the can of worms about subsequently trying to create an class from an unloaded dll… Still, handling it is no different than what people are doing with appdomains today…

  3. Robert Kozak says:

    I would pay the entire $100 to get a GetDeclaredInterfaces function that would only returned interfaces specifically declared on a type.

    public interface IService {}

    public interface IUserInterface: IService {}

    internal UserInterfaceImplementation: IUserInterface {}

    type.GetDeclaredIntefaces() would return only IUserInterface rather than type.GetInterfaces() which returns both IService and IUserInterface.

    – Robert

  4. Alan Dean says:

    $10 "first-class" xs:YearMonth and xs:Date types with XmlConvert support

    $25 TimeZone support for DateTime behaviour: conversion, ToString(), numeric (+01:00) and named TimeZones (GMT / Z)

    $10 Support for BCE dates (remove internal reliance on TickCount??)

    $35 Complete exposure of the remaining NLS API capabilities via System.Globalization

    $20 Exposure of some Windows localization resources (e.g. "Help" for menus, etc)

  5. IDisposable says:

    $20 Integrate DynamicAccessor, DynamicComparer and DynamicFilter (classes that use cached DynamicMethod-delegates to remove almost all costs to doing Reflection-like access of object properties, comparing them and filtering them).  [You can start with mine ;)]

    $30 TimeZones (and all appropriate behavior for converting to/from and tracking of input timezone/offset in DateTime).

    $10 ArgumentValidation class that brings best-practice validation of arguments, should include basic locale-safe IsNumber, IsCurrency, etc. [You can start with mine ;)]

    $15 Loan yourself out to the ASP.Net team to fix the steaming pile that is known as ObjectDataSource.

    $10 Unloadable AppDomains

    $5 Set collection and flesh out the collections (use PowerCollections for a starting point).

    $5 Fix and enhance HtmlEncode and HtmlDecode to support all W3C entities, not the subset currently supported.  Add unsafe-tag-stripping methods.

    $5 Currency class that tracks the unit of currency and the decimal.

  6. IDisposable says:

    Oh, and I forgot…

    $0 Fix TypeConverter.IsValid to actually work as documented [see: http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=9810731d-021a-4de1-90aa-24fdc0d259b4 ]

    $0 Fix Framework use of CurrentUICulture (where it should be CurrentCulture). [see: http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=b0e0eff7-7ab6-4b82-ba84-e3a181a884ef ]

    $0 Fix System.Web.Caching.CacheSingle’s TrimLock bug [see: http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=64a8cd76-0d1b-4c50-9cbc-1894fde44a4f ]

    These are bugs, trivial to fix and shouldn’t cost me anything! The first two are serious lapses in the correctness of BCL, and the last one is just silly.

  7. JP says:

    Sounds like you are scrumming..

  8. IDisposable says:

    This is more of a C# thing than the BCL, but it would REALLY rock to be able [when desired] pass a struct by-reference to operator +=, -=, *=, /=, %=.  This would make matrix operations much cheaper to implement!

    [see http://blogs.extremeoptimization.com/jeffrey/archive/2005/02/19/153.aspx ]

  9. chris-at says:

    $100 for adding a switch that makes all framework classes use CultureInfo.InvariantCulture by default.

    Currently if you miss a function you could for example write incorrect data to files (hidden bug). If it were the other way around you’d still have a bug but it would be more visible on the UI and not cause faulty data.

  10. MSDNArchive says:

    5: Units (SI, etc) as a compile-time-checkable type (probably a CLR change)

    10: Library of standard validators (numeric types, common regexes, etc)

    5: Library of common XML namespaces

    15: Library of common schemas (RSS, Exchange, etc) marked up for XLinq

    15: A type to transform a graph into something similar to a XML-navigable structure.  This would allow searching a structure for nodes matching certain patterns (see http://blogs.msdn.com/kfarmer/archive/2006/03/15/551780.aspx).  Might entail creating a standard visitor implementation (see next item).

    15: Standard, best-practices implementations of certain pattern types (singleton, sink, source, processor = sink + source, etc).  The singleton is something that most people don’t seem to get right, for one.

    10: An out-of-the-box way to wrap a stream as an IEnumerable<T> (for read-only purposes of course)

    5: Generics w/ operators (okay, so that and its ilk are actually CLR issues)

    10: List<T>.ForEach moved to IEnumerable<T>, and a multi-threaded overload made available (see http://blogs.msdn.com/kfarmer/archive/2006/04/01/566466.aspx)

    10: Array slices and indexable collections (see http://weblogs.asp.net/brianbec/archive/2006/03/15/440293.aspx)

  11. MSDNArchive says:

    Further on validators:

    I think it’d be nice to have attributes that provided the validation information, and then a method that could be called, passing in the propertyinfo/fieldinfo and the value in question.  The validation info could be grouped or otherwise named, such that you could select which validation parameters to use (for example, to select between different regexes for phones, based on the value of the country).  It would be useful to also have overrides that could take validation info directly.

    [NumericValidation(1, NumericValidationOperator.GreaterThan, 5)]

    [NumericValidation(1, NumericValidationOperator.IsOdd)]

    [NumericValidation(2, NumericValidationOperator.IsEven)]

    int Foo





       if (Validate(MethodBase.GetCurrentMethod()))

       { this._foo = value; }


       { … exception … }



  12. MSDNArchive says:

    Re indexable collections and slicing: meant to link to http://blogs.msdn.com/kfarmer/archive/2006/04/01/566466.aspx

  13. Dono says:

    $70: More collections!

    (Start with PowerCollections and C5 as a baseline. At least include the basics: sets, binary trees, etc.)

    $20: Complex number support

    (Needs to interop well with base numeric types; add appropriate support in System.Math)

    $10: Better use of generics where useful (Enum.Parse<T>, WeakReference<T> etc.)

    And please pass on the following requests (I’m on my knees begging!) to the CLR & C# teams.

    -Generic operator overloading

    -Covariant return types (including out parameters)

  14. MSDNArchive says:

    10: Rationals

    You’d of course need the means to reduce them to avoid over/underflows.  But a buddy just suggested you could just wrap everything in a checked and do the reduction in the case of an exception — this could happen automatically.  Exposing prime factorization for the numbers would be good as well.

  15. IDisposable says:

    re: Rationals.

    You can get a pretty strong implementation from the CodeProject stuff I contributed on here:


    I’ve got a slightly improved version I can blog about if anyone is interested which uses Generics to get even clearer.

  16. Andrew Webb says:

    Add a StringComparison parameter to the Contains and Replace methods of the String class.


    I’m sure there are other useful suggestions for you on Ladybug that have been lurking there unlooked at for months.

  17. Stu Smith says:

    Not sure if this comes under the heading of BCL but I’d split it between fixing the GDI+ "dancing characters" bug and fixing GDI+ drawing rectangles with missing corner pixels. It’s a pain to have to P/Invoke down to straight GDI just to draw text.

  18. Michael Cox says:

    Memory mapped files (80$)

    Basic functions to handle reading and writing big endian values for binary data sources generated from somewhere else (20$)

  19. Krzysztof Cwalina says:

    I would like to thank all who provided comments. Many of the comments validate planing work we have done, and many provide good feedback for us to adjust our plans. We will keep you posted (on this blog) about more details of the upcomming features as we start to design and implement them.


  20. saad rehmani says:

    memory mapped streams … $50

    more more more datastructures. a non-standard generics collection impl with virtual in case you’re willing to give up the performance penalty would be nifty … $50

  21. John says:

    $80 for better DateTime types, that are nullable.  

    $10 make the windows DateTimePicker control nullable.

    $10 make the DateTimePicker able to handle dates prior to 1/1/1753!!

  22. IDisposable says:

    I’m not a fan of nullable values (I much prefer the NullableObject pattern).  What would be excellent would be for DateTime.MinValue and DateTime.MaxValue to be recognised as-such and handled correctly on the UI and database binding edges.  I had to add that support to Wilson’s O/R Mapper, and to my ASP.Net controls.  It wasn’t hard, but it sure seems like redundant work that everyone would have to do. If the database providers and the UI elements all handled things consistantly, I wouldn’t have had to waste the time.

    BTW, the whole nullable object pattern with DateTimes lets me ask for live people the simple query:

     SELECT Person.ID

     WHERE GetDate() BETWEEN Person.DateOfBirth AND Person.DateOfDeath

    all I have to do is insure that my business logic uses DateTime.MinValue for "unknown" birthdates and DateTime.MaxValue for "unknown" date-of-death.  This beats the heck out of nullable dates anytime!

  23. KeithH says:

    $20 for standard XML namespaces and schemas like the other Keith suggested.

    $30 for more generics constraints.  I want to be able to write generic (int, float,double) math libraries.

    $10 big endian support in BitConverter and BinaryReader/Writer.

    $40 to provide a mechanism to automatically determine/document as many possible exceptions that can be thrown by a method. I’m not asking for "enforced" checked exceptions just help in determining what could be thrown by a method.  It helps to anticipate how you might recover or if you can recover.

  24. Balaji says:

    $100 – A decent DDE module in the framework.

    (I do not use .net, but when I looked at it earlier I could not find a DDE library. I do not know how much had since changed. Excuse my lack of knowledge, but I hope my investment is still valid)

  25. Steve says:

    Well, I’ve already ranted about my topic <a href="http://spine.cx/article.php?sid=1030">on my personal blog</a>.  System.IO classes can’t seem to access anything in a path longer than 260 characters, even with the old "\?" hack.  I’ve had this complaint about Windows Explorer for years, but now to actually take a step backward in my programming interface?  That is outrageous.

    $100 on making 32000 character paths accessible in .NET.

  26. Stalker says:

    $90 for object obj = X.Evaluate("2 + 3 * 4 > 5");

    $10 for Win32 ScrollWindowEx

  27. Max says:

    $100 just to remove sealed keyword from Graphics class and make its methods virtual (or replace Graphics with IGraphics)

  28. BioSlayer says:

    33$ generic arithmetic.

    33$ A non Direct X Math Library with Vectors and Matrixes.

    33$ support for generics in the soap serializer.

    1$ make generic constraints propagated so you don’t have to keep restating them.

  29. I wonder if this falls under what some calls a generic operator overloading but it’s going to help a lot if we can dynamically check during runtime if a type supports the "+", "-", "*", "/" and other operators on the primitive types (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=331902&SiteID=1).

    Thanks very much.

  30. Kathy Kam says:

    As a relatively new blogger, I am still learning what are good topics to blog. One of the metric I used…

  31. Kathy Kam says:

    Today, I learned an intersting (and very important) lesson about building a framework. I was in a meeting…

  32. What I would like is more CLR related than BCL but nontheless

    20$ Generics : Operator constraints

    40$ Generics : Templated Inheritance

    10$ Vector Math lib (non DirectX)

    30$ Remove sealed keyword from System.Data clases

  33. Yuvi says:

    Well, I’ll put my 100$ on making the System.IO Namespace, especially the Reader/Writer Classes Cleaner.

  34. I’ll spend every of my 100$ on making STL/CLR instead of BCL stuff.

    BCL is not standardized in its implementation.

    Where’s the ReadOnlyDictionary class ? Why ReadOnlyCollection inherits form IList? Why thinks among collection are not symetrics?Whenever you use a container, you have to learn many new tricks, algorithms and every thing that miss must be implemented on the side. I wonder how different ReadOnlyDictionary class exist.

    STL from the C++ world use to be fully standardized for the container and the algorithm. One algorithm works the same way for every container that support its underlying functions.

    Probably BCL have the same overall functionnality but it is package in one the ugliest way I ever see. It is a shame I have to use it the way it is organized.

  35. I’ve had this come up in conversations in the past (and it’s been on feedback for almost 3 years now

  36. I&#39;ve had this come up in conversations in the past (and it&#39;s been on feedback for almost 3 years