C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
CreateSemanticModelFromSource ( IEnumerable fileContent ) : void

Описание методов

AddFiles() публичный Метод

add new files to the list of files for this source code
public AddFiles ( ) : SourceCode
Результат SourceCode

AddSource() публичный Метод

adds the content of a file to this source code
public AddSource ( string content ) : SourceCode
content string
Результат SourceCode

Class() публичный Метод

public Class ( string className ) : Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax
className string
Результат Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax

Compile() публичный Метод

creates the semantic model out of all the source code that was added to this instance
public Compile ( ) : void
Результат void

CompileFromAssemblyOfType() публичный Метод

public CompileFromAssemblyOfType ( Type externalType ) : void
externalType System.Type
Результат void

CreateClass() публичный Метод

public CreateClass ( string className ) : ClassWithSourceCode
className string
Результат ClassWithSourceCode

GetTypeByName() публичный Метод

public GetTypeByName ( string className ) : ITypeSymbol
className string
Результат ITypeSymbol

MixinInClass() публичный Метод

public MixinInClass ( string className, string mixin ) : Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax
className string
mixin string
Результат Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax

New() публичный Метод

fluent API, resets the file list that were used to generate the source code
public New ( ) : SourceCode
Результат SourceCode

SourceCode() публичный Метод

public SourceCode ( ) : Microsoft.CodeAnalysis
Результат Microsoft.CodeAnalysis