Miscellaneous Debris
Avner Kashtan's Frustrations and Exultations
-
Problems with params array?
I noticed today that the ever-popular String.Format() method has several overloads - in addition to the Format(string format, params object[] args) overload I was expecting, it seems there are three … more
-
Query SUBST information
For various reasons involving out testing framework, I found myself needing to get the full command-line of the current executing assembly. However, our development environment uses the DOS SUBST … more
-
From Accessors to Properties
For various debugging processes, I find myself needing to find several bits of runtime information for my properties. This means I want to get the property's PropertyInfo object by Reflection when … more
-
Serializing Dictionaries
Dictionaries have been an annoyance when serializing for a while now. IDictionary in v1.1 and now IDictionary<K,V> in v2.0 are both non-serializable, forcing us to find workarounds or use … more
-
Bad compiler warnings when using anonymous methods for Predicate<T>
I was sitting around munching some code, and needed to filter a list I had: List<Whatever> list = // get list outputList = list.FindAll(delegate(Whatever item){ if (// blah … more
-
Creating nested directories
Just a quick tip to prevent others from feeling as foolish as I do: The static CreateDirectory() method of the System.IO.Directory class will create the entire directory tree passed to it. There's no … more
-
Non-generic default values in C#? Why not?!
A relatively obscure new keyword in C# 2.0 is the default(T) keyword. It's shorthand for checking if the given generic parameter T is a value type or reference type. If it's a reference type, it … more
-
Context-Bound Thread Queuer - FunFun.
As I mentioned in my previous post, I have a need to consistently pass an operation context to any thread I choose to spin. Doing so manually, as I did here, involves a lot of ugly, repetitive code … more
-
OperationContext is ThreadStatic
WCF Services tend to be big, heavy duty things. When I write a service I often want it to do a lot of work for a lot of clients, and it should do it efficiently. This usually means that I will use … more
-
Share your interfaces - avoid static proxies.
When using WCF services, we have several options for creating the proxies. We can create them statically using SVCUTIL or the build-in IDE support (Add Service Reference...), or we can generate them … more