Class CsEnum
Data model that represents an enumeration definition.
Implements
Inherited Members
Namespace: CodeFactory.DotNet.CSharp
Assembly: CodeFactory.DotNet.dll
Syntax
public abstract class CsEnum : CsModel, ICsEnum, IDotNetEnum, ICsNestedModel, ICsModel, ICsAttributes, IDotNetNestedModel, IDotNetModel, IModelStatus, ISourceFiles, IDotNetAttributes, IDocumentation, ILookup, IParent, IParent
Constructors
| Improve this Doc View SourceCsEnum(bool, bool, bool, SourceCodeType, IReadOnlyList<CsAttribute>, string, bool, string, string, string, IReadOnlyList<string>, string, string, CsSecurity, IReadOnlyList<CsEnumValue>, bool, CsNestedType, string, ModelStore<ICsModel>, IReadOnlyList<ModelLoadException>)
Constructor for the CsEnum
Declaration
protected CsEnum(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, IReadOnlyList<CsAttribute> attributes, string parentPath, bool hasDocumentation, string documentation, string lookupPath, string modelSourceFile, IReadOnlyList<string> sourceFiles, string name, string ns, CsSecurity security, IReadOnlyList<CsEnumValue> values, bool isNested, CsNestedType nestedType, string sourceDocument = null, ModelStore<ICsModel> modelStore = null, IReadOnlyList<ModelLoadException> modelErrors = null)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isLoaded | Flag that determines if the model was loaded. |
| bool | hasErrors | Flag that determine if errors were found creating the model. |
| bool | loadedFromSource | Flag that determines if the model was loaded from source code or from an existing library. |
| SourceCodeType | language | The target language the model was generated from. |
| IReadOnlyList<CsAttribute> | attributes | List of the attributes assigned to this model. |
| string | parentPath | The fully qualified lookup path for the parent model to this one. |
| bool | hasDocumentation | Flag that determines if the model has XML documentation assigned to it. |
| string | documentation | The xml documentation assigned to the model. |
| string | lookupPath | The fully qualified model lookup path for this model. |
| string | modelSourceFile | The source code file the model was generated from. |
| IReadOnlyList<string> | sourceFiles | List of the fully qualified paths to the source code files this model is defined in. |
| string | name | The name of the model. |
| string | ns | |
| CsSecurity | security | The security scope assigned to this model. |
| IReadOnlyList<CsEnumValue> | values | The enumeration values assigned to this enumeration. |
| bool | isNested | Flag that determines if the container type is nested in another type definition. |
| CsNestedType | nestedType | Enumeration of the type of nesting the container is. |
| string | sourceDocument | The source document that was used to build this model. This is optional parameter and can be null. |
| ModelStore<ICsModel> | modelStore | Optional the lookup storage for models created during the compile or lookup of the model. |
| IReadOnlyList<ModelLoadException> | modelErrors | Optional the error that occurred while creating the model. |
Properties
| Improve this Doc View SourceAttributes
The attributes assigned to this item. If the HasAttributes is false this will be an empty list.
Declaration
public IReadOnlyList<CsAttribute> Attributes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<CsAttribute> |
Documentation
Documentation that has been assigned to this model.
Declaration
public string Documentation { get; }
Property Value
| Type | Description |
|---|---|
| string |
HasAttributes
Flag that determines if attributes are assigned.
Declaration
public bool HasAttributes { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasDocumentation
Flag that determines if the model has code level documentation assigned to it.
Declaration
public bool HasDocumentation { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsNested
Flag that determines if this model is nested in a parent model.
Declaration
public bool IsNested { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LookupPath
The fully qualified path for this model that can be used when searching the source for the model.
Declaration
public string LookupPath { get; }
Property Value
| Type | Description |
|---|---|
| string |
ModelSourceFile
Declaration
public string ModelSourceFile { get; }
Property Value
| Type | Description |
|---|---|
| string |
Name
The name of the enumeration.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Namespace
The namespace the enumeration belongs to.
Declaration
public string Namespace { get; }
Property Value
| Type | Description |
|---|---|
| string |
NestedType
Identifies the type of model that has been nested.
Declaration
public CsNestedType NestedType { get; }
Property Value
| Type | Description |
|---|---|
| CsNestedType |
Parent
The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
Declaration
public CsModel Parent { get; }
Property Value
| Type | Description |
|---|---|
| CsModel |
Security
The security scope assigned to the enumeration.
Declaration
public CsSecurity Security { get; }
Property Value
| Type | Description |
|---|---|
| CsSecurity |
SourceFiles
The source file or files in which the model was loaded from. This will be an empty enumeration if the source models were loaded from metadata only.
Declaration
public IReadOnlyList<string> SourceFiles { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Values
List of the enumeration values implemented in this enumeration.
Declaration
public IReadOnlyList<CsEnumValue> Values { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<CsEnumValue> |
Methods
| Improve this Doc View SourceAddAfterAsync(string, string)
Adds the source code directly after the definition of the ICsEnumin the target document.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> AddAfterAsync(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 added to 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. |
AddAfterAsync(string)
Adds the source code directly after the definition of the ICsEnumin the target document.
Declaration
public abstract Task<CsSource> AddAfterAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be added to 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. |
AddAfterDocsAsync(string)
Adds the supplied source code directly after the documentation.
Declaration
public abstract Task<CsSource> AddAfterDocsAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The target syntax to be added to the document. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | Updated CsSource model with the injected source code. |
AddBeforeAsync(string, bool)
Declaration
public abstract Task<CsSource> AddBeforeAsync(string sourceCode, bool ignoreLeadingModelsAndDocs)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | |
| bool | ignoreLeadingModelsAndDocs |
Returns
| Type | Description |
|---|---|
| Task<CsSource> |
AddBeforeAsync(string, string)
Adds the source code directly before the definition of the ICsEnumin the target document.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> AddBeforeAsync(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 added to 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. |
AddBeforeAsync(string)
Adds the source code directly before the definition of the ICsEnumin the target document.
Declaration
public abstract Task<CsSource> AddBeforeAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be added to 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. |
AddBeforeDocsAsync(string)
Adds the supplied source code directly before the documentation.
Declaration
public abstract Task<CsSource> AddBeforeDocsAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The target syntax to be added to the document. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | Updated CsSource model with the injected source code. |
AddToBeginningAsync(string)
Adds the source code inside of the enumeration at the beginning of where members are defined in the enumeration.
Declaration
public abstract Task<CsSource> AddToBeginningAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be added to the document. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
AddToEndAsync(string)
Adds the source code inside of the enumeration at the end of where members are defined in the enumeration.
Declaration
public abstract Task<CsSource> AddToEndAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The source code that is to be added to the document. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
DeleteAsync()
Deletes the definition of the enumeration from the source document.
Declaration
public abstract Task<CsSource> DeleteAsync()
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the enumeration has been removed from the document. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
DeleteAsync(string)
Deletes the definition of the enumeration from the source document.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> DeleteAsync(string sourceDocument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The source document that the enumeration is to be removed from. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the enumeration has been removed from the document. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
DeleteDocsAsync()
Deletes the documentation from the target supporting code artifact.
Declaration
public abstract Task<CsSource> DeleteDocsAsync()
Returns
| Type | Description |
|---|---|
| Task<CsSource> | Updated CsSource model with the documentation removed. |
GetBodySourceLocationAsync()
Gets the starting and ending locations of the body located in the enum.
Declaration
public abstract Task<ISourceLocation> GetBodySourceLocationAsync()
Returns
| Type | Description |
|---|---|
| Task<ISourceLocation> | The source location in the enum. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Raised when an error occurs getting the location from the document. |
GetSourceLocationAsync()
Gets the starting and ending locations within the document where the enumeration is located.
Declaration
public abstract Task<ISourceLocation> GetSourceLocationAsync()
Returns
| Type | Description |
|---|---|
| Task<ISourceLocation> | The source location for the enumeration. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Raised when an error occurs getting the location from the document. |
GetSourceLocationAsync(string)
Gets the starting and ending locations within the document where the enumeration is located.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<ISourceLocation> GetSourceLocationAsync(string sourceDocument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the document that has the enumeration defined in. |
Returns
| Type | Description |
|---|---|
| Task<ISourceLocation> | The source location for the enumeration. |
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Raised when an error occurs getting the location from the document. |
ReplaceAsync(string, string)
Replaces the current enumeration with the provided source code.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> ReplaceAsync(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 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. |
ReplaceAsync(string)
Replaces the current enumeration with the provided source code.
Declaration
public abstract Task<CsSource> ReplaceAsync(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. |
ReplaceDocsAsync(string)
Replaces the supplied source code directly this the documentation.
Declaration
public abstract Task<CsSource> ReplaceDocsAsync(string sourceCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceCode | The target syntax to be added to the document. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | Updated CsSource model with the injected source code. |
Explicit Interface Implementations
| Improve this Doc View SourceIDotNetAttributes.Attributes
The attributes assigned to this item. If the HasAttributes is false this will be an empty list.
Declaration
IReadOnlyList<IDotNetAttribute> IDotNetAttributes.Attributes { get; }
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IDotNetAttribute> |
IDotNetEnum.Security
The security scope assigned to the enumeration.
Declaration
DotNetSecurity IDotNetEnum.Security { get; }
Returns
| Type | Description |
|---|---|
| DotNetSecurity |
IDotNetEnum.Values
List of the enumeration values implemented in this enumeration.
Declaration
IReadOnlyList<IDotNetEnumValue> IDotNetEnum.Values { get; }
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IDotNetEnumValue> |
IDotNetNestedModel.NestedType
Identifies the type of model that has been nested.
Declaration
DotNetNestedType IDotNetNestedModel.NestedType { get; }
Returns
| Type | Description |
|---|---|
| DotNetNestedType |
IParent.Parent
The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
Declaration
IDotNetModel IParent.Parent { get; }
Returns
| Type | Description |
|---|---|
| IDotNetModel |