Interface ICsMethod
Model definition of a method in c#.
Inherited Members
Namespace: CodeFactory.WinVs.Models.CSharp
Assembly: CodeFactory.WinVs.dll
Syntax
public interface ICsMethod : ICsMember, ICsModel, IModelStatus, ISourceFiles, ICsAttributes, IDocumentation, IParent, ILookup, ICsGeneric
Properties
HasParameters
Flag that determines if the method has parameters assigned to it.
Declaration
bool HasParameters { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsAbstract
Flag that determines if the method has been implemented as abstract.
Declaration
bool IsAbstract { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsAsync
Flag that determines if the method implements the Async keyword.
Declaration
bool IsAsync { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsExtension
Flag that determines if the method is an extension method.
Declaration
bool IsExtension { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsOverride
Flag that determines if the method has been overridden.
Declaration
bool IsOverride { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsSealed
Flag that determines if the method has been sealed.
Declaration
bool IsSealed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsStatic
Flag that determines if this is a static method.
Declaration
bool IsStatic { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsVirtual
Flag that determines if the method has been implemented as virtual.
Declaration
bool IsVirtual { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsVoid
Flag that determines if the methods return type is void.
Declaration
bool IsVoid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MethodType
Determines the type of method that was loaded into this model.
Declaration
CsMethodType MethodType { get; }
Property Value
| Type | Description |
|---|---|
| CsMethodType |
Parameters
Enumeration of the parameters that have been assigned to the method. If HasParameters property is set to false this will be null.
Declaration
IReadOnlyList<CsParameter> Parameters { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<CsParameter> |
ReturnType
The type information about the return type assigned to the method. if flag
Declaration
CsType ReturnType { get; }
Property Value
| Type | Description |
|---|---|
| CsType |
SyntaxContent
Determines how the internal syntax for the method is stored.
Declaration
SyntaxType SyntaxContent { get; }
Property Value
| Type | Description |
|---|---|
| SyntaxType |
Methods
AddToBeginningBodySyntaxAsync(string)
Adds the source code to the beginning of the method body. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
Task<CsSource> AddToBeginningBodySyntaxAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be added to the method body. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
AddToBeginningBodySyntaxAsync(string, string)
Adds the source code to the beginning of the method body. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
Task<CsSource> AddToBeginningBodySyntaxAsync(string sourceDocument, string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the source document to be updated. |
| string | sourceCode | The source code that is to be added to the method body. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
AddToEndBodySyntaxAsync(string)
Adds the source code to the end of the method body. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
Task<CsSource> AddToEndBodySyntaxAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be added to the method body. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
AddToEndBodySyntaxAsync(string, string)
Adds the source code to the end of the method body. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
Task<CsSource> AddToEndBodySyntaxAsync(string sourceDocument, string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the source document to be updated. |
| string | sourceCode | The source code that is to be added to the method body. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
DeleteBodySyntaxAsync()
Deletes the source syntax from the method body. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
Task<CsSource> DeleteBodySyntaxAsync()
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
DeleteBodySyntaxAsync(string)
Deletes the source syntax from the method body. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
Task<CsSource> DeleteBodySyntaxAsync(string sourceDocument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the source code document to be updated. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
GetBodySyntaxAsync()
The source code syntax that is stored in the body of the method. This will be null if the method was not loaded from source code or the SyntaxContent is not set to Body.
Declaration
Task<string> GetBodySyntaxAsync()
Returns
| Type | Description |
|---|---|
| Task<string> |
GetBodySyntaxListAsync()
The source code syntax that is stored in the body of the method. This will be null if the method was not loaded from source code or the SyntaxContent is not set to Body. This will return each line of code that has a line feed or return as a separate string.
Declaration
Task<List<string>> GetBodySyntaxListAsync()
Returns
| Type | Description |
|---|---|
| Task<List<string>> |
GetExpressionSyntaxAsync()
Gets the expression that has been assigned to the method. This will be null if the method was not loaded from source code or the SyntaxContent is not set to Expression.
Declaration
Task<string> GetExpressionSyntaxAsync()
Returns
| Type | Description |
|---|---|
| Task<string> |
ReplaceBodySyntaxAsync(string)
Replaces the syntax in the body of the method. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
Task<CsSource> ReplaceBodySyntaxAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be used to replace the original definition in the document. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
ReplaceBodySyntaxAsync(string, string)
Replaces the syntax in the body of the method. The ContentSyntax must be set to Body or else an exception will be thrown.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
Task<CsSource> ReplaceBodySyntaxAsync(string sourceDocument, string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the source code document to be updated. |
| string | sourceCode | The source code that is to be used to replace the original definition in the body of the method. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
ReplaceExpressionAsync(string)
Replaces the expression assigned to the method with the provided source code. The ContentSyntax must be set to Expression or else an exception will be thrown.
Declaration
Task<CsSource> ReplaceExpressionAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that will replace the original expression. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |
ReplaceExpressionAsync(string, string)
Replaces the expression assigned to the method with the provided source code. The ContentSyntax must be set to Expression or else an exception will be thrown.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
Task<CsSource> ReplaceExpressionAsync(string sourceDocument, string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the source code document to be updated. |
| string | sourceCode | The source code that will replace the original expression. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
| CodeFactoryException | Error is raised if the incorrect ContentSyntax is present. |