Scott Dorman

ephemeral segment

  Home  |   Contact  |   Syndication    |   Login
  566 Posts | 9 Stories | 568 Comments | 51 Trackbacks

News


Post Categories

Image Galleries



Creative Commons License


Microsoft MVP


MCP Profile


Locations of visitors to this page

Subscribers to this feed

TwitterCounter for @sdorman

View blog authority

Add to Technorati Favorites

Windows Live Alerts

AddThis Social Bookmark Button

LinkedIn profile

Community Credit profile

The Code Project

Follow me on Twitter

Get Free Shots from Snap.com

Community Credit Hall of Fame

Get Feedghost

Xobni outlook add-in for your inbox

Windows Live Translator


Support This Site

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Friday, June 26, 2009 #

I’m sure most of you are familiar with the Sams Teach Yourself books, at least in passing if not in owning one. I am very excited to announce that I will be joining the Sams Publishing authoring team for their upcoming Teach Yourself C# 2010 in 24 Hours book.

This new edition will be quite a bit different from the previous editions since it will be much more language-focused and will take a more holistic view of the language. If you have already looked at one of the earlier editions and decided that it wasn’t for you, please give the new edition a chance to change your mind; for those of you who already have an earlier edition, I hope this one will be of interest to you as well.

As it gets closer to the release date, I’ll be sure to let everyone know when it will be available.

I also want to thank Keith Elder, Shawn Weisfeld, Brad Abrams, and Krzysztof Cwalina for providing some excellent feedback on the table of contents.

DotNetKicks Image

Thursday, June 25, 2009 #

Just a quick reminder that the June 2009 meeting is tonight from 6:30 PM - 8:30 PM (ET) at the Microsoft office. Please be sure to register so we have a good idea of how much pizza to order.

Enterprise Architecture

What is it? Why is it important? An overview of Enterprise Architecture as a discipline, its principles, methods, frameworks and tools. This session will explore the growing role and importance of enterprise architecture in the management of organizations.

Speaker: Bob Otterberg is the Chief Technologist for the US Applications organization at EDS, an HP company. In this role Bob determines, supports and influences the technical direction of the Applications Delivery to meet business requirements through appropriate implementation of technology and process. He aligns technology strategy with business needs and investigates innovative process and technology opportunities based on strategic business goals. Otterberg also oversees consistency across Applications Delivery within the US.

When & Where:
Thursday, June 26, 2009 from 06:30 PM - 08:30 PM (ET)

Microsoft Corporation
5426 Bay Center Dr
Suite 700
Tampa, FL 33609
View a map
View 1-Click Directions


Please be sure to register so we have a good idea of how much pizza to order.

Technorati Tags:
Digg This

Monday, June 08, 2009 #

Attribute programming has a lot of benefits and, when done correctly, can greatly simplify the amount of code that you need to write. One drawback to using attributes is that the code required to retrieve a custom attribute from a type is a bit cumbersome and is very repetitious.

Given a type, the simplest way to retrieve a custom attribute is code like

CustomAttribute attribute = Attribute.GetCustomAttribute(customType.GetType(), typeof(CustomAttribute), true) as CustomAttribute;

While this is simple code, it doesn’t handle any error conditions and requires that you always remember to perform the cast. A more complete method would look like

public static CustomAttribute GetAttribute(MemberInfo element)
{
CustomAttribute attribute = null;

try
{
attribute = Attribute.GetCustomAttribute(element, typeof(CustomAttribute), true) as CustomAttribute;
}
catch
{
// We aren't really interested in the exceptions here, but if we do get an exception
// just return null;
attribute = null;
}

return attribute;
}

This nicely encapsulates the error handling and casting, but introduces another drawback. In order to make use of this method you would need to include it on every custom attribute you create, being sure to change the types appropriately.
 
We can make this more practical by changing to a generic extension method with very little effort
public static T GetAttribute<T>(this MemberInfo element) where T: Attribute
{
T attribute = null;

if (element != null)
{
try
{
attribute = Attribute.GetCustomAttribute(element, typeof(T), true) as T;
}
catch
{
// We aren't really interested in the exceptions here, but if we do get an exception
// just return null;
attribute = null;
}
}

return attribute;
}

The benefit here is that, because this is implemented as an extension method it is available as if it were a real method call on any class derived from MemberInfo, which happens to be the base class for all of the Type classes.
 
Now, we can define our custom attributes without any special consideration to providing a strongly typed GetAttribute method and when we want to retrieve a custom attribute, we can use code that now looks like
CustomAttribute attribute = customType.GetType().GetAttribute<CustomAttribute>();

It might not look like a major change in the calling site, but we are now able to quickly and easily get a strongly typed attribute given an instance type.

Technorati Tags: ,
Digg This

Monday, June 01, 2009 #

clip_image002_thumbMicrosoft’s latest incarnation of it’s search engine, which has gone by a few different code names, is live a few days early.

It’s still early, so it remains to be seen if Microsoft will be able to pull any search market share away from Google, but Bing looks like it may be a good start. The biggest difference is that Bing seems to offer better organization by putting the related searches list along the left side of the search results where you can see it without scrolling. It also provides a search history, and contextual information for each result.

image

From the Live Search blog, Bing is a

…new kind of search that goes beyond traditional search engines to help you make faster, more informed decisions. It will do this by combining a great search engine (with powerful new features to improve your results for any query), more organized results, and unique tools to help you make important decisions.

If you are running Internet Explorer 8, you can install Bing as your search engine through the Add-ons Gallery, for any other browser Sarah Perez has a good summary of how to accomplish this.

For Windows 7, I have created a search connector you can install to integrate Bing as a federated search site.


Monday, May 18, 2009 #

I’m still waiting for an “official” announcement, but if you are an MSDN subscriber you will be able to download Visual Studio 2010 Beta 1 later today (May 18), probably around 12:00 PM (PST). If you aren’t an MSDN subscriber, you will be able to download Beta 1 on May 20 through Microsoft Downloads.

Technorati Tags: