Udostępnij za pośrednictwem


Metoda TextTransformation.Warning —

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

Przestrzeń nazw:  Microsoft.VisualStudio.TextTemplating
Zestaw:  Microsoft.VisualStudio.TextTemplating.11.0 (w Microsoft.VisualStudio.TextTemplating.11.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: System.String
    Komunikat, który opisuje ostrzeżenie.

Uwagi

Dodaje ostrzeżenie do kolekcji Errors dla procesu transformacji tekst szablonu.Ustawia liczbę linii błąd -1 i numer kolumny błąd-1, domyślnie.

Przykłady

Poniższy przykład kodu pokazuje wywołania Warning metody z szablonu tekstu.Wklej ten kod do dowolnego pliku tekstowego, szablon, a następnie uruchom transformacji tekst szablonu, aby zobaczyć wyniki.Ostrzeżenie to wyświetlane jest w Listy 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