Whidbey "Go To Definition" Feature
So I am digging through some MDX code tonight and I see a class I hadn't heard of before. I am thinking that it is a helper class that the SDK Sample framework has created, so I right click on the class name and select “Go To Definition“. Sure enough I am taken to a source file that has all of the methods of the class along with Xml comments, etc. The odd thing is that the class looks like a “header” file. No method bodies. I take a look at the tab up top and next to the class name is a “[from metadata]” tag. Neat! So instead of dumping me into the Object Browser for externally defined classes, it actually generated a class definition on the fly. On my home machine I currently only have the C# Express version installed, so I'm not sure if this is a C# feature or a more general VS 2005 feature.
Here is what you get if you “Go To Definition“ for System.Object:
namespace System
{
/// <summary>Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.</summary>
/// <filterpriority>1</filterpriority>
[System.Runtime.InteropServices.ClassInterfaceAttribute(2)]
public class Object
{
/// <summary>Determines whether the specified <see cref="T:System.Object" /> instances are considered equal.</summary>
/// <returns>true if objA is the same instance as objB or if both are null references or if objA.Equals(objB) returns true; otherwise, false.</returns>
/// <param name="objB">The second <see cref="T:System.Object" /> to compare. </param>
/// <param name="objA">The first <see cref="T:System.Object" /> to compare. </param>
/// <filterpriority>2</filterpriority>
public static bool Equals(object objA, object objB);
/// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />.</summary>
/// <returns>true if the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />; otherwise, false.</returns>
/// <param name="obj">The <see cref="T:System.Object" /> to compare with the current <see cref="T:System.Object" />. </param>
/// <filterpriority>2</filterpriority>
public virtual bool Equals(object obj);
/// <summary>Serves as a hash function for a particular type. <see cref="M:System.Object.GetHashCode" /> is suitable for use in hashing algorithms and data structures like a hash table.</summary>
/// <returns>A hash code for the current <see cref="T:System.Object" />.</returns>
/// <filterpriority>2</filterpriority>
public virtual int GetHashCode();
/// <summary>Gets the <see cref="T:System.Type" /> of the current instance.</summary>
/// <returns>The <see cref="T:System.Type" /> instance that represents the exact runtime type of the current instance.</returns>
/// <filterpriority>2</filterpriority>
public System.Type GetType();
/// <summary>Creates a shallow copy of the current <see cref="T:System.Object" />.</summary>
/// <returns>A shallow copy of the current <see cref="T:System.Object" />.</returns>
protected object MemberwiseClone();
/// <summary>Initializes a new instance of the <see cref="T:System.Object" /> class.</summary>
public Object();
/// <summary>Determines whether the specified <see cref="T:System.Object" /> instances are the same instance.</summary>
/// <returns>true if objA is the same instance as objB or if both are null references; otherwise, false.</returns>
/// <param name="objB">The second <see cref="T:System.Object" /> to compare. </param>
/// <param name="objA">The first <see cref="T:System.Object" /> to compare. </param>
/// <filterpriority>2</filterpriority>
public static bool ReferenceEquals(object objA, object objB);
/// <summary>Returns a <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.</summary>
/// <returns>A <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.</returns>
/// <filterpriority>2</filterpriority>
public virtual string ToString();
/// <summary>Allows an <see cref="T:System.Object" /> to attempt to free resources and perform other cleanup operations before the <see cref="T:System.Object" /> is reclaimed by garbage collection.</summary>
[System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(3, 2)]
~Object();
}
}
Comments
- Anonymous
July 03, 2004
Very nifty. I wonder what the <filterpriority /> tag is... I don't think that's part of the standard xml documentation in VS.NET 2003. Do you (or anyone else) know? - Anonymous
July 03, 2004
Mitch: This feature is currently C# only. :-) - Anonymous
January 10, 2009
Note : this entry has moved . I am a big fan of using XML comments in code and actually have a few Visual