Class NamespaceManager
Utility class that allows you to load in a collection of using statements for target namespaces that will be used for source generation operations for the C# programming language.
Inherited Members
Namespace: CodeFactory.WinVs.Models.CSharp
Assembly: CodeFactory.WinVs.dll
Syntax
public class NamespaceManager
Constructors
NamespaceManager(IEnumerable<IUsingStatementNamespace>, string)
Creates an instance of the NamespaceManager
Declaration
public NamespaceManager(IEnumerable<IUsingStatementNamespace> usingStatements = null, string targetNamespace = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IUsingStatementNamespace> | usingStatements | Using statements to be used for formatting in code output. |
| string | targetNamespace | Additional namespace to check for that will be the target namespace the content will be managed under. |
Methods
AddNamespace(IUsingStatementNamespace)
Adds additional namespace to the namespace manager.
Declaration
public NamespaceManager AddNamespace(IUsingStatementNamespace nameSpace)
Parameters
| Type | Name | Description |
|---|---|---|
| IUsingStatementNamespace | nameSpace | Using statement to add to the namespace manager. |
Returns
| Type | Description |
|---|---|
| NamespaceManager | New instance of the namespace manager with the added using statements. |
AddNamespace(string, string)
Adds an additional namespace to the namespace manager.
Declaration
public NamespaceManager AddNamespace(string nameSpace, string alias = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | nameSpace | Target namespace to be added to the manager. |
| string | alias | Optional, the alias to assign to the target namespace. |
Returns
| Type | Description |
|---|---|
| NamespaceManager |
AddNamespaces(IEnumerable<ICsUsingStatement>)
Adds additional namespaces to the namespace manager.
Declaration
public NamespaceManager AddNamespaces(IEnumerable<ICsUsingStatement> nameSpaces)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ICsUsingStatement> | nameSpaces | Using statements to add to the namespace manager. |
Returns
| Type | Description |
|---|---|
| NamespaceManager | New instance of the namespace manager with the added using statements. |
AppendingNamespace(string)
Defines the appending namespace that will be appended to types or other declares based on if the namespace is currently supported by using or namespace definitions.
Declaration
public string AppendingNamespace(string nameSpace)
Parameters
| Type | Name | Description |
|---|---|---|
| string | nameSpace | Namespace to format |
Returns
| Type | Description |
|---|---|
| string | Null if the namespace is not needed or the formatted substring of the namespace used in declarations and other actions. |
ValidNameSpace(string)
Determines if the provides namespace was found.
Declaration
public (bool namespaceFound, bool hasAlias, string alias) ValidNameSpace(string nameSpace)
Parameters
| Type | Name | Description |
|---|---|---|
| string | nameSpace | The namespace to search for in the namespace manager. |
Returns
| Type | Description |
|---|---|
| (bool namespaceFound, bool hasAlias, string alias) | Returns a tuple that determine the namespace was found and if the found namespace had an alias. |