Sdílet prostřednictvím


TextTransformation.Warning – metoda

Vytvoří nové upozornění k ukládání informací o chybách během procesu transformace textu šablony.

Obor názvů:  Microsoft.VisualStudio.TextTemplating
Sestavení:  Microsoft.VisualStudio.TextTemplating.11.0 (v Microsoft.VisualStudio.TextTemplating.11.0.dll)

Syntaxe

'Deklarace
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
    Zpráva, která popisuje varování.

Poznámky

Přidá upozornění do kolekce Errors procesu transformace textu šablony.Ve výchozím nastavení nastaví číslo řádku došlo k chybě -1 a sloupec číslo chyby-1.

Příklady

Následující příklad kódu ukazuje volací Warning metoda text šablony.Vložte tento kód na libovolný textový soubor šablony a šablony transformace textu výsledky spuštění.Upozornění se zobrazí v Seznam chyb.

<#
    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
#>

Zabezpečení rozhraní .NET Framework

Viz také

Referenční dokumentace

TextTransformation Třída

Microsoft.VisualStudio.TextTemplating – obor názvů

Errors

Další zdroje

How to: Generate Errors and Warnings from Text Templates