Megosztás a következőn keresztül:


GeneratorPostInitializationContext.AddSource Method

Definition

Overloads

AddSource(String, SourceText)

Adds a SourceText to the compilation that will be available during subsequent phases

AddSource(String, String)

Adds source code in the form of a String to the compilation that will be available during subsequent phases

AddSource(String, SourceText)

Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs

Adds a SourceText to the compilation that will be available during subsequent phases

public void AddSource (string hintName, Microsoft.CodeAnalysis.Text.SourceText sourceText);
member this.AddSource : string * Microsoft.CodeAnalysis.Text.SourceText -> unit
Public Sub AddSource (hintName As String, sourceText As SourceText)

Parameters

hintName
String

An identifier that can be used to reference this source text, must be unique within this generator

sourceText
SourceText

The SourceText to add to the compilation

Remarks

Directory separators "/" and "" are allowed in hintName, they are normalized to "/" regardless of host platform.

Applies to

AddSource(String, String)

Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs
Source:
GeneratorContexts.cs

Adds source code in the form of a String to the compilation that will be available during subsequent phases

public void AddSource (string hintName, string source);
member this.AddSource : string * string -> unit
Public Sub AddSource (hintName As String, source As String)

Parameters

hintName
String

An identifier that can be used to reference this source text, must be unique within this generator

source
String

The source code to add to the compilation

Applies to