Udostępnij za pośrednictwem


Element CodeSnippet (urywki kodu IntelliSense)

Umożliwia określenie pozycji i wielu technologii IntelliSense urywki kodu, który można wstawić do Visual Studio kod plików.

<CodeSnippet Format="x.x.x">
    <Header>... </Header>
    <Snippet>... </Snippet>
</CodeSnippet>

Atrybuty i elementy

W poniższych sekcjach opisano atrybuty i elementy podrzędne elementy nadrzędne.

Atrybuty

Atrybut

Opis

Format

Wymagany atrybut.

Określa wersję schematu wstawki kodu programu.Format Atrybutu musi być ciągiem w składni x.x.x, gdzie każdy "x" oznacza wartość liczbową z numerem wersji.Visual Studiobędzie ignorować urywki kodu z Format atrybuty, które nie są zrozumiałe.

Elementy podrzędne

Element

Opis

Nagłówek

Wymaganego elementu.

Zawiera ogólne informacje na temat wstawki kodu programu.Ponadto musi być dokładnie jeden Header element wstawki kodu programu.

Urywek

Wymaganego elementu.

Zawiera kod, który będzie wstawiany przez program Visual Studio.Ponadto musi być dokładnie jeden Snippet element wstawki kodu programu.

Elementy nadrzędne

Element

Opis

CodeSnippets

Element główny schematu XML wstawkę kodu.

Przykład

Poniższy kod przedstawia wstawkę kodu wersji docelowej 1.0.0 schematu XML wstawkę kodu.

<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <!-- Insert header information here -->
        </Header>
        <Snippet>
            <!-- Insert snippet information here -->
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Zobacz też

Koncepcje

Odwołanie schematu wstawek kodu