IVSSItem.IsDifferent Property 

Gets a value indicating whether a master SourceSafe file is different from its local copy.

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

Syntax

'Declaration
ReadOnly Property IsDifferent ( _
    <InAttribute> <OptionalAttribute> Optional Local As String = "" _
) As Boolean
'Usage
Dim instance As IVSSItem
Dim Local As String
Dim value As Boolean

value = instance.IsDifferent(Local)
bool IsDifferent [
    [OptionalAttribute] [InAttribute] string Local
] { get; }
property bool IsDifferent [String^] {
    bool get ([InAttribute] [OptionalAttribute] String^ Local);
}
/** @property */
boolean get_IsDifferent (/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Local)
JScript supports the use of indexed properties, but not the declaration of new ones.

Parameters

  • Local
    A string representing a fully qualified path to the local copy of a file stored in the working folder.

Property Value

true if there is a difference between a master SourceSafe file and a local copy, otherwise false.

Remarks

[IDL]

HRESULT IsDifferent ([in,defaultvalue(0)]BSTR Local, [out,retval]boolean *pbDifferent);

A local copy (stored in the working folder on your computer) may differ from the SourceSafe master file (most recently checked-in version of a file stored in a SourceSafe database). The two files may be different because the local copy has been changed since the last check out or because the master file was changed by another user while you were working on the local copy.

The IsDifferent property applies to file objects only. If you attempt to access the IsDifferent property of a project object, a run-time error is generated.

Example

The following example demonstrates how to use the IsDifferent property.

To test this property:

  1. Check out a file.

  2. Run this example.

    The result displays the following text:The file in VSS database is not different from the file in the working folder.

  3. Make changes to the local copy.

  4. Run this example

    The result displays the following test: The file in VSS database is different from the file in the working folder.

[C#]

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

public class IVSSTest
{
    public static void Main()
    {
        string testFile = "$/TestFolder/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, ""); 

        // Get a IVSSItem reference to the file object.
        IVSSItem vssFile = vssDatabase.get_VSSItem(testFile, false);

        if(vssFile.get_IsDifferent(vssFile.LocalSpec))
            Console.WriteLine("The file in VSS database is different " +
                              "from the file in the working folder.");
        else    
            Console.WriteLine("The file in VSS database is not different " +
                              "from the file in the working folder.");
    }
}

[Visual Basic]

Imports System
Imports Microsoft.VisualStudio.SourceSafe.Interop

Module IVSSTest

    Public Sub Main()

        Dim testFile As String = "$/TestFolder/test.txt"

        ' Create a VSSDatabase object.
        Dim vssDatabase As IVSSDatabase = New VSSDatabase

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

        ' Get an IVSSItem reference to the file object.
        Dim vssFile As IVSSItem = vssDatabase.VSSItem(testFile, False)

        If vssFile.IsDifferent(vssFile.LocalSpec) Then
                Console.WriteLine("The file in VSS database is different " + _
                                  "from the file in the working folder.")
        Else
                Console.WriteLine("The file in VSS database is not different " + _
                                  "from the file in the working folder.")
        End If

    End Sub

End Module

See Also

Reference

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