using System;
using System.Diagnostics;
namespace AnticipatingMinds.Genesis.CodeDOM{
/// <summary>
/// Represents import declaration in namespace.
/// </summary>
/// <remarks>
/// In C# import is specified by using 'using' directives.
/// Imported name may be namespace or an aliased (optionaly) type.
/// </remarks>
[Serializable]
public class CodeNamespaceImport : CodeElement
{
#region Instance constructors
/// <summary>
/// Initializes new CodeNamespaceImport class.
/// </summary>
/// <remarks>
/// Initializes new CodeNamespaceImport class and sets
/// ImportedName and Alias to String.Empty
/// </remarks>
public CodeNamespaceImport():this(string.Empty,string.Empty){}
/// <summary>
/// Initializes new instance of the <see cref="CodeNamespaceImport"/> class.
/// </summary>
/// <param name="importedTypeOrNamespaceName">Name of the namespace or type being imported.</param>
/// <remarks>Alias is initialized to String.Empty</remarks>
public CodeNamespaceImport(string importedTypeOrNamespaceName): this (importedTypeOrNamespaceName,string.Empty){}
/// <summary>
/// Initializes new instance of the <see cref="CodeNamespaceImport"/> class.
/// </summary>
/// <param name="importedTypeOrNamespaceName">Name of the namespace or type being imported.</param>
/// <param name="alias">Alias of imported type or namespace.</param>
public CodeNamespaceImport(string importedTypeOrNamespaceName,string alias)
{
this.importedName = importedTypeOrNamespaceName;
this.alias = alias;
}
#endregion Instance constructors
#region Public instance properties
/// <summary>
/// Gets or sets name of imported namespace or type.
/// </summary>
public string ImportedName
{
get
{
return importedName;
}
set
{
importedName = (value == null ? string.Empty:value);
}
}
/// <summary>
/// gets or sets alias of imported type or namespace.
/// </summary>
public string Alias
{
get
{
return alias;
}
set
{
alias = (value == null ? string.Empty:value);
}
}
/// <summary>
/// Gets or sets declaring namespace.
/// </summary>
public CodeNamespace DeclaringNamespace
{
get
{
return Parent as CodeNamespace;
}
}
#endregion Public instance properties
#region Private instance fields
private string importedName = String.Empty;
private string alias;
#endregion Private instance fields
}
}
|