CSharpFeeds - All your C# feeds in one place.

Wednesday, October 08, 2008

Mapping from a type to an instance of that type

by skeet via Jon Skeet: Coding Blog on 10/8/2008 8:24:09 PM

A question came up on Stack Overflow yesterday which I've had to deal with myself before now. There are times when it's helpful to have one value per type, and that value should be an instance of that type. To express it in pseudo-code, you want an IDictionary<typeof(T), T> except with T varying across all possible types. Indeed, this came up in Protocol Buffers at least once, I believe. .NET generics don't have any way of expressing this, and you end up with boxing and a cast. ...

[ read more ]

Mapping from a type to an instance of that type

by skeet via Jon Skeet: Coding Blog on 10/8/2008 8:24:09 PM

A question came up on Stack Overflow yesterday which I've had to deal with myself before now. There are times when it's helpful to have one value per type, and that value should be an instance of that type. To express it in pseudo-code, you want an IDictionary<typeof(T), T> except with T varying across all possible types. Indeed, this came up in Protocol Buffers at least once, I believe. .NET generics don't have any way of expressing this, and you end up with boxing and a cast. ...

[ read more ]

Why boxing doesn't keep me awake at nights

by skeet via Jon Skeet: Coding Blog on 10/8/2008 7:42:02 PM

I'm currently reading the (generally excellent) CLR via C#, and I've recently hit the section on boxing. Why is it that authors feel they have to scaremonger about the effects boxing can have on performance? Here's a piece of code from the book: using System;public sealed class Program {   public static void Main() {      Int32 v = 5;   // Create an unboxed value type variable.#if INEFFICIENT    &nbs ...

[ read more ]

The Future of C#, Part One

by Eric Lippert via Fabulous Adventures In Coding on 10/8/2008 3:06:00 PM

An attentive reader pointed me at this long thread on a third-party forum where some people are musing about possible future features of C#. There is far, far more here than I possibly have time to respond to in any kind of detail. Also, I am not going to spill the beans. Anders is giving a talk at the PDC at the end of the month. His talk is titled "The Future of C#" and I'm not going to steal Anders' thunder (or give our marketing department conniptions) by giving specific details a ...

[ read more ]

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us