C# Class MixinRefactoring.Test.SourceCode

helper class for interaction with source code. The class takes several source code files as parameters and allows access to the syntax and semantic information of the classes. This class now also has a fluent API to add source code on the fly. Before using the fluent API, ensure that you call New() to erase all existing content (if desired) and at the end, call Compile() to generate a compilation unit and a semantic model from the collected source code.
Afficher le fichier Open project: pgenfer/mixinSharp Class Usage Examples

Méthodes publiques

Méthode Description
AddFiles ( ) : SourceCode

add new files to the list of files for this source code

AddSource ( string content ) : SourceCode

adds the content of a file to this source code

Class ( string className ) : Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax
Compile ( ) : void

creates the semantic model out of all the source code that was added to this instance

CompileFromAssemblyOfType ( Type externalType ) : void
CreateClass ( string className ) : ClassWithSourceCode
GetTypeByName ( string className ) : ITypeSymbol
MixinInClass ( string className, string mixin ) : Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax
New ( ) : SourceCode

fluent API, resets the file list that were used to generate the source code

SourceCode ( ) : Microsoft.CodeAnalysis

Private Methods

Méthode Description
CreateSemanticModelFromSource ( IEnumerable fileContent ) : void

Method Details

AddFiles() public méthode

add new files to the list of files for this source code
public AddFiles ( ) : SourceCode
Résultat SourceCode

AddSource() public méthode

adds the content of a file to this source code
public AddSource ( string content ) : SourceCode
content string
Résultat SourceCode

Class() public méthode

public Class ( string className ) : Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax
className string
Résultat Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax

Compile() public méthode

creates the semantic model out of all the source code that was added to this instance
public Compile ( ) : void
Résultat void

CompileFromAssemblyOfType() public méthode

public CompileFromAssemblyOfType ( Type externalType ) : void
externalType System.Type
Résultat void

CreateClass() public méthode

public CreateClass ( string className ) : ClassWithSourceCode
className string
Résultat ClassWithSourceCode

GetTypeByName() public méthode

public GetTypeByName ( string className ) : ITypeSymbol
className string
Résultat ITypeSymbol

MixinInClass() public méthode

public MixinInClass ( string className, string mixin ) : Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax
className string
mixin string
Résultat Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax

New() public méthode

fluent API, resets the file list that were used to generate the source code
public New ( ) : SourceCode
Résultat SourceCode

SourceCode() public méthode

public SourceCode ( ) : Microsoft.CodeAnalysis
Résultat Microsoft.CodeAnalysis