Proprietà IVSSItem.Type

Ottiene un valore che indica se un determinato elemento è un file o un progetto.

Spazio dei nomi: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)

Sintassi

'Dichiarazione
ReadOnly Property Type As Integer
'Utilizzo
Dim instance As IVSSItem
Dim value As Integer

value = instance.Type
int Type { get; }
property int Type {
    int get ();
}
/** @property */
int get_Type ()
function get Type () : int

Valore proprietà

Un valore che indica se un determinato elemento è un file o un progetto.

Elemento

Costante

Valore

Project

VSSITEM_PROJECT

0

File

VSSITEM_FILE

1

Note

[IDL]

HRESULT Type ([out,retval]int *piType);

Esempio

Nell'esempio riportato di seguito viene illustrato come utilizzare la proprietà Type per determinare se un elemento è un file o un progetto. Per eseguire l'esempio:

  • Creare un progetto $/TestFolder/.

    $/TestFolder/ contiene: test.txt.

[C#]

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

public class IVSSTest
{
    public static void Main()
    {
        string testFolder = "$/TestFolder";
        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 IVSSItem references to the project and the file objects.
        IVSSItem vssFolder = vssDatabase.get_VSSItem(testFolder, false);
        DisplayType(vssFolder);
        VSSItem vssFile = vssDatabase.get_VSSItem(testFile, false);
        DisplayType(vssFile);
    }

    private static void DisplayType(IVSSItem vssItem)
    {
        switch((VSSItemType)vssItem.Type)
        {
            case VSSItemType.VSSITEM_FILE:
                Console.WriteLine(vssItem.Spec + " is a file");
                break;
            case VSSItemType.VSSITEM_PROJECT:
                Console.WriteLine(vssItem.Spec + " is a project");
                break;
            default:    
                Console.WriteLine("Is unknown type");
                break;
        }
    }
}

Output:

$/TestFolder is a project

$/TestFolder/test.txt is a file

Vedere anche

Riferimenti

Interfaccia IVSSItem
Membri IVSSItem
Spazio dei nomi Microsoft.VisualStudio.SourceSafe.Interop