Share via


IVSSVersion.Comment Property 

Gets a string containing a comment for the action.

Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)

Syntax

'Declaration
ReadOnly Property Comment As String
'Usage
Dim instance As IVSSVersion
Dim value As String

value = instance.Comment
string Comment { get; }
property String^ Comment {
    String^ get ();
}
/** @property */
String get_Comment ()
function get Comment () : String

Property Value

A string containing a comment for the action, or an empty string if no comment is provided.

Remarks

[IDL]

HRESULT Comment ([out,retval]BSTR *pComment);

Example

The following example demonstrates how to iterate through the IVSSVersions collection of a file and display the Comment property for each version.

using System;
using Microsoft.VisualStudio.SourceSafe.Interop;

public class IVSSTest
{
    public static void Main()
    {
        string testFile = "$/A/test.txt";

        // Create a VSSDatabase object.
        IVSSDatabase vssDatabase = new VSSDatabase();

        // Open a VSS database using network name 
        // for automatic user login.
        vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini", 
                         Environment.UserName, ""); 

        Console.WriteLine("\n$/A/test.txt versions: \n");
        Console.WriteLine("-------------------------------------------------------");
        Console.WriteLine("{0,-4}{1,-14}{2,-15}{3,-16}", 
                          "Ver", "Comment", "Action", "Date");
        Console.WriteLine("-------------------------------------------------------");
        IVSSItem vssFile = vssDatabase.get_VSSItem(testFile, false);
        foreach(IVSSVersion vssVersion in vssFile.get_Versions(0))    
            Console.WriteLine("{0,-4}{1,-14}{2,-15}{3,-16}", 
                              vssVersion.VersionNumber, vssVersion.Comment, 
                              vssVersion.Action, vssVersion.Date);
        Console.WriteLine("-------------------------------------------------------");
    }
}

Output:

$/A/test.txt versions:

-------------------------------------------------------
Ver Comment       Action         Date
-------------------------------------------------------
14                Labeled 'Lbl1' 11/8/2003 12:41:12 PM
3   Ver 3         Checked in $/A 11/4/2003 10:47:30 PM
2   Ver 2         Checked in $/A 11/4/2003 10:46:48 PM
1                 Created        11/4/2003 10:45:52 PM
-------------------------------------------------------

See Also

Reference

IVSSVersion Interface
IVSSVersion Members
Microsoft.VisualStudio.SourceSafe.Interop Namespace