Udostępnij za pośrednictwem


Metoda TextTransformation.Warning —

Tworzy nowe ostrzeżenie do przechowywania informacji na temat błędów, które występują w trakcie procesu transformacji tekst szablonu.

Przestrzeń nazw:  Microsoft.VisualStudio.TextTemplating
Zestaw:  Microsoft.VisualStudio.TextTemplating.12.0 (w Microsoft.VisualStudio.TextTemplating.12.0.dll)

Składnia

'Deklaracja
Public Sub Warning ( _
    message As String _
)
public void Warning(
    string message
)
public:
void Warning(
    String^ message
)
member Warning : 
        message:string -> unit
public function Warning(
    message : String
)

Parametry

  • message
    Typ: String

    Komunikat, który opisuje ostrzeżenie.

Uwagi

Dodaje ostrzeżenie do kolekcji Errors dla procesu transformacji tekst szablonu.Domyślnie ustawia numer błędu -1, a numer kolumny błędu na -1.

Przykłady

Poniższy przykład kodu demonstruje telefonicznej Warning metoda z szablonu tekstu.Wklej ten kod do dowolnego pliku tekstowego, szablon i uruchamiania transformacja szablon tekst, aby zobaczyć wyniki.Zostanie wyświetlone ostrzeżenie w Lista błędów.

<#
    string lastName = "short";

    if(lastName.Length < 6)
    {
        //raise a warning, this will appear in the error list
        Warning("I have a really short name.");
    }
#> 
<#
    Dim lastName as string = "short"

    If lastName.Length < 6 Then

        'raise a warning, this will appear in the error list
        Me.Warning("I have a really short name.")
    End If
#>

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

TextTransformation Klasa

Przestrzeń nazw Microsoft.VisualStudio.TextTemplating

Errors

Inne zasoby

How to: Generate Errors and Warnings from Text Templates