The Description Attribute

The Description attribute allows you to add text to the description field on the General Properties tab of an application, component, interface, or method. Example 10-2 shows how to apply the Description attribute at the assembly, class, interface, and method levels. After registration, the assembly-level description string becomes the content of the hosting COM+ application’s description field; the class description string becomes the content of the COM+ component description field. The interface and method descriptions are mapped to the corresponding interface and method in the Component Services Explorer.

Example 10-2. Applying the Description attribute at the assembly, class, interface, and method levels

[assembly: Description("My Serviced Components Application")]

[Description("IMyInterface description")]
public interface IMyInterface
{ 
   [Description("MyMethod description")]   
   void MyMethod(  );
}

[Description("My Serviced Component description")]
public class MyComponent :ServicedComponent,IMyInterface
{
   public void MyMethod(  ){}
}

Get COM & .NET Component Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.