MichaelDev
Monday, December 27, 2004
  URIs, URLs, and strings
I've been wondering why several methods in the .Net framework accept a string parameter for a URL. Furthermore, there's that whole URL vs. URI issue.

Here's an article I liked on the URI vs. URL issue:
http://www.bernzilla.com/item.php?id=100

In looking at the .Net framework classes Uri and Url, it seems they intend the Url class to be something special to use in verifying security policy on assemblies. It's part of the System.Security.Policy namespace. Furthermore, it messes with security permissions, which is a whole topic unto itself in .Net. I decided it makes more sense to use the Uri class for what I'm doing, even though I'm specifically working with a URL in this siutation. I just didn't like the fact that the Url class is tied into System.Security.Policy.

I'm designing some framework classes and want to be careful about the APIs. So, I was wondering why did Microsoft choose a string instead of using the Uri class in various places in the Framework. While I don't know the answer to that question, I found a great blog from Brad Abrams (lead program manager for the .Net framework). It's a design guideline for using a Uri vs. string.

Here's the blog: http://weblogs.asp.net/brada/archive/2004/01/12/58031.aspx

Maybe this guideline means we'll see some overloaded methods in the future that accept both a string and a Uri. Meanwhile, I'm going ahead and using the Uri class instead of a string parameter.
 
Comments: Post a Comment



<< Home
Various notes on software development. Currently using C# and .Net. May also include comments on the overall software development process, etc.

Name:
Location: Orange County, California, United States
ARCHIVES
June 2004 / July 2004 / August 2004 / September 2004 / October 2004 / November 2004 / December 2004 / January 2005 / February 2005 / March 2005 / April 2005 / May 2005 / September 2005 / October 2005 / November 2005 / January 2006 / February 2006 / April 2006 / May 2006 / June 2006 / March 2007 /


Powered by Blogger