In the OData specification, the $format parameter can be passed on the query string of the request to tell the server that you would like the response to be serialized as JSON. Normally, to get JSON-formatted data, you have to specify "application/json" in your "Accept" header. The query string feature is handy in situations when [...]
Posts tagged .NET
Ummm OK?
Okay, I get the idea but come on… Talk about verbose errors. I guess it’s better than “Argument out of range.” Custom tool warning: There was a validation error on a schema generated during export: Validation Error: Wildcard ‘##any’ allows element ‘Account’, and causes the content model to become ambiguous. A content model must be [...]
Dock TweetDeck to the side of your screen with PowerShell
I wanted to post this last night but I did not have an internet connection. The best part about being a developer is that when software drives you nuts, many times you can do something about it that mere mortals cannot. That’s the case with TweetDeck. I love it but I am sick of having [...]
Path.Combine in .NET 4
I recently blogged about a new method I noticed in .NET 4 on the Enum class. One of the great things about .NET 4 is that it is a new version of base class library too. In .NET 3.0 and 3.5 as we all know, the CLR and BCL was left at version 2.0 which [...]
Enum.HasFlag in .NET 4
Shh… hear that? It’s the sound of a million developers ripping out their home-grown HasFlag, IsFlagSet, CheckFlag, etc helper methods. Just noticed that in .NET 4 System.Enum now has a built-in HasFlag method. As Forrest Gump would say “Lt. Dan says we don’t have to worry about enum flags no more. That’s good. One less [...]
Awesome Extension Methods: In and Between
These ones are pretty simple in implementation but go a long way to cleaning up your code. In some cases, the slight performance overhead may not be acceptable but I haven’t run into any real-world problems with them. Check out the usage below. int x = 3; // is x either 1, 3, or 5? [...]
Easy way to prevent WebBrowser control from using window.alert
There are all sorts of official ways of doing this implementing various IE hosting interfaces in order to handle the presentation of the UI. But if you’re trying to automate a web page and a pesky window.alert is blocking your progress, the following code will supress it for the current page. /// <summary> /// Handles [...]
Awesome Extension Methods: IEnumerable.Batch
.NET 3.5 brought a bunch of great extension methods to the framework, most of which extended the IEnumerable<T> (or IQueryable<T>) interfaces implemented by just about every collection type. These include simple ones such as Where, OrderBy, FirstOrDefault, etc as well as more complex ones like Aggregate, GroupBy, etc. The Enumerable class really covers a lot [...]
Awesome Extension Methods: String.MatchInto
Regular Expressions in .NET are pretty easy to use (assuming you understand the Regex syntax which is beside the case) and certainly you can think of some useful extension methods for System.String that would allow you to quickly validate against a particular regular expression pattern. But regular expressions have another great feature that you maybe [...]
Keeping AssemblyInfo in sync across a solution
Here’s a helpful tip if you frequently find yourself wrestling with AssemblyInfo.cs (or AssemblyInfo.vb, etc.) when working with a solution with a large number of projects. I find that most of the time, almost all the information except the AssemblyTitle, AssemblyDescription, and GUID are the same across all projects. Even the GUID you can ignore [...]
Posts