Geeks With Blogs


Microsoft Store

Support This Site

AddThis Social Bookmark Button

Locations of visitors to this page

Subscribers to this feed

TwitterCounter for @sdorman

Creative Commons License

Scott Dorman Microsoft MVP, Software Architect, Developer, Author CSharp There are 13 entries for the tag CSharp
Reading all bytes from a Stream
I was working on some Stream extensions today and added a method which will read all of the data from a stream in to a byte array. Some of the classes which derive from Stream provide a similar method (MemoryStream, for example, provides a GetBuffer() method to do this). The drawback here is that the base Stream class doesn’t provide an abstract GetBuffer() method; instead it’s up to each individual derived class to implement such a method. This is perfectly reasonable as a stream may not have an ......

Posted On Saturday, January 10, 2009 3:24 PM

More on .NET 4.0 Code Contracts
Last month I talked about Code Contracts, which are one of the new features in .NET 4.0. Earlier today I was digging around in .NET Reflector looking for something totally unrelated when I came across the Microsoft.Contracts namespace in System.Core. Looking at the Contract class reveals some custom exception types and a bunch of static methods that look surprisingly similar to what will be available in the CodeContract class in .NET 4.0. What does this mean? It means that Microsoft internally was ......

Posted On Wednesday, December 10, 2008 1:36 PM

C# 4.0: New Features Whitepaper
I’ve blogged a lot about the new features available in C# 4.0 recently, with each feature getting a dedicated blog post. Mads Torgersen, a C# PM and member of the C# design team, together with other members of the C# team have created a document that outlines the new features in C# 4.0. This whitepaper, combined with Anders’ PDC talk is one of the best ways to get a good overview of what’s coming. There are also a set of C# 4.0 samples available which demonstrate how to use the new language features: ......

Posted On Sunday, November 23, 2008 10:55 AM

Anders Hejlsberg on C# 4.0
If you attended PDC hopefully you had a chance to hear Anders’ talk on C# 4.0; if not you can watch it on Channel 9. During that talk, one of the primary new features he focused on was the new dynamic keyword and all of the new features that come along with it. Building on that talk, Anders and C# Community PM Charlie Calvert talk about questions that have come up in the community about what the new dynamic features mean. Technorati Tags: C# 4.0, dynamic ......

Posted On Sunday, November 23, 2008 10:45 AM

CLR 4.0: Code Contracts
If anyone is familiar with the Microsoft Research (MSR) project Spec# you will be familiar with the idea of contract based programming. CLR 4.0 takes the idea of contract based programming (and more specifically code contracts to ensure code validity) from Spec# and adds it to the CLR. This now means that code contracts are available to any .NET language. The premise behind code contracts is that you (the programmer) know a lot about your code, including when input arguments should and shouldn’t ......

Posted On Friday, November 7, 2008 2:58 PM

Visual Studio Optimizations
There are always a lot of posts about various add-ins, code snippets, macros, and other utilities that are designed to make you, the developer, more productive within Visual Studio as an editing environment. However, there seem to very few posts that talk about how to actually improve the performance of Visual Studio itself. Browsing through some of the questions on Stack Overflow, I came across a thread asking this very question. There were a lot of non-answers, but one that definitively listed ......

Posted On Thursday, August 28, 2008 3:04 PM

Null Object pattern follow up
My earlier post on the Null Object pattern led to a few critiques about the fact that I was presenting an extension method to do what is essentially a very simple logical test, and, as a result, doesn’t provide much value. For reference, here is the original extension method from that post public static class NullObjectExtenstions { public static bool IsNull(this object source) { return (source == null); } } Yes, this is an extremely simple method and performs a very basic logical test. However, ......

Posted On Friday, July 4, 2008 9:51 AM

What is “Defensive Programming”?
My post on the Null Object pattern has generated some interesting dialog. One of the trends that I have seen is the idea that defensive programming means your code should fail as early as possible. I couldn’t agree less. According to Wikipedia, Defensive programming is a form of defensive design intended to ensure the continuing function of a piece of software in spite of unforeseeable usage of said software. The idea can be viewed as reducing or eliminating the prospect of Murphy's Law having effect. ......

Posted On Friday, July 4, 2008 9:26 AM

What Is a Build System?
A few days ago, I talked about my views on MSBuild and NAnt. In that post I mentioned the phrase "build system" several times. That, combined with catching up and re-reading some blog posts that I had flagged led me to Jeff Atwood's post "The F5 Key Is Not a Build Process". While some of Jeff's post is a bit of tongue-in-cheek humor, the points he makes are extremely valid. In order to understand what a "build system" is, you must first understand how you build code. This applies not just to individual ......

Posted On Thursday, December 27, 2007 3:58 PM

The history of C#
I just came across a very interesting post from James Kovacs that describes how C# and .NET evolved. I had blogged about this almost a year ago, but James' post adds some additional background. Around 1997, Microsoft started a project that was internally known as Project Lightning (and also known as Project 42). The name "Project 42" was most likely because DevDiv (the Microsoft Developer Division) is in Building 42, which (as James points out) is probably an homage to The Hitchhiker's Guide to the ......

Posted On Wednesday, September 26, 2007 12:13 PM

The Code Project Browser Add-in for Visual Studio
I received an email today through my blog from one of the developers at SlickEdit, who also happens to be a member of The Code Project community, letting me know about a new Visual Studio Add-in they have developed. You may remember I blogged about the free SlickEdit Gadgets, a really great set of Add-ins for Visual Studio. Since I am also a member of The Code Project community, I spend a lot of time on the web site answering forum questions and reading the articles posted. I also spend a lot of ......

Posted On Wednesday, August 15, 2007 8:29 PM

C# 3.0 Language Specification

The C# Unified Language Specification is now available for review. If you are wondering why it is called the "Unified" language specification, it pulls together information from the C# 1.1, 2.0 and 3.0 specifications into a single unified document.

Posted On Saturday, July 28, 2007 9:57 AM

NDepend 2.2
A few months ago, I wrote about Visual Studio 2005 Professional Edition and FxCop Integration and also the upcoming Visual Studio Code Metrics that will be available in the Visual Studio "Orcas" release. These are both great tools, but one is really only available if you purchase one of the Visual Studio 2005 Team Edition versions (at least, available without some extra work) and one isn't available yet except through a public beta. However, if you want the type of code analysis that you can get ......

Posted On Sunday, May 20, 2007 12:30 PM

Copyright © Scott Dorman | Powered by: