Class ConfigNode
Provides configuration node abstraction for section and attribute nodes. This class is thread-safe
Inheritance
System.Object
ConfigNode
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.dll
Syntax
[Serializable]
public abstract class ConfigNode : IConfigNode, INamed
Constructors
ConfigNode(Configuration, ConfigSectionNode)
Declaration
protected ConfigNode(Configuration conf, ConfigSectionNode parent)
Parameters
ConfigNode(Configuration, ConfigSectionNode, IConfigNode)
Creates new node by cloning other node from this or another configuration
Declaration
protected ConfigNode(Configuration conf, ConfigSectionNode parent, IConfigNode clone)
Parameters
ConfigNode(Configuration, ConfigSectionNode, String, String)
Declaration
protected ConfigNode(Configuration conf, ConfigSectionNode parent, string name, string value)
Parameters
Fields
m_Configuration
Declaration
protected Configuration m_Configuration
Field Value
m_Modified
Declaration
protected bool m_Modified
Field Value
Type |
Description |
System.Boolean |
|
Properties
Configuration
References configuration this node is under
Declaration
public Configuration Configuration { get; }
Property Value
EvaluatedValue
Returns null or value of this node with all variables evaluated
Declaration
public string EvaluatedValue { get; }
Property Value
Type |
Description |
System.String |
|
Exists
Determines whether this node really exists in configuration or is just a sentinel empty node
Declaration
public bool Exists { get; }
Property Value
Type |
Description |
System.Boolean |
|
Modified
Indicates whether a node was modified
Declaration
public virtual bool Modified { get; }
Property Value
Type |
Description |
System.Boolean |
|
Name
Declaration
public string Name { get; set; }
Property Value
Type |
Description |
System.String |
|
Parent
References parent node or Empty if this node has no parent
Declaration
public ConfigSectionNode Parent { get; }
Property Value
RootPath
Returns path from root to this node
Declaration
public string RootPath { get; }
Property Value
Type |
Description |
System.String |
|
Value
Retrieves node value or null. The value getter performs evaluation of variables, while setter sets the value verbatim
Declaration
public string Value { get; set; }
Property Value
Type |
Description |
System.String |
|
VerbatimValue
Returns verbatim (without variable evaluation) node value or null
Declaration
public string VerbatimValue { get; }
Property Value
Type |
Description |
System.String |
|
Methods
Delete()
Declaration
public abstract void Delete()
IsSameName(IConfigNode)
Returns true when another node has the same name as this one per case-insensitive culture-neutral comparison
Declaration
public bool IsSameName(IConfigNode other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
IsSameName(String)
Returns true when another name is the same as this node's name per case-insensitive culture-neutral comparison
Declaration
public bool IsSameName(string other)
Parameters
Type |
Name |
Description |
System.String |
other |
|
Returns
Type |
Description |
System.Boolean |
|
ResetModified()
Declaration
public virtual void ResetModified()
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()
ValueAsBool(Boolean, Boolean)
Declaration
public bool ValueAsBool(bool dflt = false, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Boolean |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Boolean |
|
ValueAsByte(Byte, Boolean)
Declaration
public byte ValueAsByte(byte dflt = 0, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Byte |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Byte |
|
ValueAsByteArray(Byte[], Boolean)
Declaration
public byte[] ValueAsByteArray(byte[] dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Byte[] |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Byte[] |
|
ValueAsDateTime(DateTime, Boolean)
Declaration
public DateTime ValueAsDateTime(DateTime dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.DateTime |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.DateTime |
|
ValueAsDecimal(Decimal, Boolean)
Declaration
public decimal ValueAsDecimal(decimal dflt = 0M, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Decimal |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Decimal |
|
ValueAsDecimalArray(Decimal[], Boolean)
Declaration
public decimal[] ValueAsDecimalArray(decimal[] dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Decimal[] |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Decimal[] |
|
ValueAsDouble(Double, Boolean)
Declaration
public double ValueAsDouble(double dflt = 0, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Double |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Double |
|
ValueAsDoubleArray(Double[], Boolean)
Declaration
public double[] ValueAsDoubleArray(double[] dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Double[] |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Double[] |
|
ValueAsEnum<TEnum>(TEnum, Boolean)
Declaration
public TEnum ValueAsEnum<TEnum>(TEnum dflt = default(TEnum), bool verbatim = false)
where TEnum : struct
Parameters
Type |
Name |
Description |
TEnum |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type Parameters
ValueAsFloat(Single, Boolean)
Declaration
public float ValueAsFloat(float dflt = 0F, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Single |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Single |
|
ValueAsFloatArray(Single[], Boolean)
Declaration
public float[] ValueAsFloatArray(float[] dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Single[] |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Single[] |
|
ValueAsGDID(GDID, Boolean)
Declaration
public GDID ValueAsGDID(GDID dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
GDID |
dflt |
|
System.Boolean |
verbatim |
|
Returns
ValueAsGUID(Guid, Boolean)
Declaration
public Guid ValueAsGUID(Guid dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Guid |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Guid |
|
ValueAsInt(Int32, Boolean)
Declaration
public int ValueAsInt(int dflt = 0, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Int32 |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Int32 |
|
ValueAsIntArray(Int32[], Boolean)
Declaration
public int[] ValueAsIntArray(int[] dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Int32[] |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Int32[] |
|
ValueAsLong(Int64, Boolean)
Declaration
public long ValueAsLong(long dflt = 0L, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Int64 |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Int64 |
|
ValueAsLongArray(Int64[], Boolean)
Declaration
public long[] ValueAsLongArray(long[] dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Int64[] |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Int64[] |
|
ValueAsNullableBool(Nullable<Boolean>, Boolean)
Declaration
public bool? ValueAsNullableBool(bool? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Boolean> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Boolean> |
|
ValueAsNullableByte(Nullable<Byte>, Boolean)
Declaration
public byte? ValueAsNullableByte(byte? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Byte> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Byte> |
|
ValueAsNullableDateTime(Nullable<DateTime>, Boolean)
Declaration
public DateTime? ValueAsNullableDateTime(DateTime? dflt = default(DateTime? ), bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.DateTime> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.DateTime> |
|
ValueAsNullableDecimal(Nullable<Decimal>, Boolean)
Declaration
public decimal? ValueAsNullableDecimal(decimal? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Decimal> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Decimal> |
|
ValueAsNullableDouble(Nullable<Double>, Boolean)
Declaration
public double? ValueAsNullableDouble(double? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Double> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Double> |
|
ValueAsNullableEnum<TEnum>(Nullable<TEnum>, Boolean)
Declaration
public TEnum? ValueAsNullableEnum<TEnum>(TEnum? dflt = default(TEnum? ), bool verbatim = false)
where TEnum : struct
Parameters
Type |
Name |
Description |
System.Nullable<TEnum> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<TEnum> |
|
Type Parameters
ValueAsNullableFloat(Nullable<Single>, Boolean)
Declaration
public float? ValueAsNullableFloat(float? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Single> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Single> |
|
ValueAsNullableGDID(Nullable<GDID>, Boolean)
Declaration
public GDID? ValueAsNullableGDID(GDID? dflt = default(GDID? ), bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<GDID> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<GDID> |
|
ValueAsNullableGUID(Nullable<Guid>, Boolean)
Declaration
public Guid? ValueAsNullableGUID(Guid? dflt = default(Guid? ), bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Guid> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Guid> |
|
ValueAsNullableInt(Nullable<Int32>, Boolean)
Declaration
public int? ValueAsNullableInt(int? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int32> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
ValueAsNullableLong(Nullable<Int64>, Boolean)
Declaration
public long? ValueAsNullableLong(long? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int64> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Int64> |
|
ValueAsNullableSByte(Nullable<SByte>, Boolean)
Declaration
public sbyte? ValueAsNullableSByte(sbyte? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.SByte> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.SByte> |
|
ValueAsNullableShort(Nullable<Int16>, Boolean)
Declaration
public short? ValueAsNullableShort(short? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int16> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.Int16> |
|
ValueAsNullableTimeSpan(Nullable<TimeSpan>, Boolean)
Declaration
public TimeSpan? ValueAsNullableTimeSpan(TimeSpan? dflt = default(TimeSpan? ), bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.TimeSpan> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.TimeSpan> |
|
ValueAsNullableUInt(Nullable<UInt32>, Boolean)
Declaration
public uint? ValueAsNullableUInt(uint? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.UInt32> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.UInt32> |
|
ValueAsNullableULong(Nullable<UInt64>, Boolean)
Declaration
public ulong? ValueAsNullableULong(ulong? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.UInt64> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.UInt64> |
|
ValueAsNullableUShort(Nullable<UInt16>, Boolean)
Declaration
public ushort? ValueAsNullableUShort(ushort? dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Nullable<System.UInt16> |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Nullable<System.UInt16> |
|
ValueAsSByte(SByte, Boolean)
Declaration
public sbyte ValueAsSByte(sbyte dflt = 0, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.SByte |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.SByte |
|
ValueAsShort(Int16, Boolean)
Declaration
public short ValueAsShort(short dflt = 0, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.Int16 |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.Int16 |
|
ValueAsString(String, Boolean)
Declaration
public string ValueAsString(string dflt = null, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.String |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.String |
|
ValueAsTimeSpan(TimeSpan, Boolean)
Declaration
public TimeSpan ValueAsTimeSpan(TimeSpan dflt, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.TimeSpan |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.TimeSpan |
|
ValueAsType(Type, Boolean, Boolean)
Tries to get value as specified type or throws if it can not be converted
Declaration
public object ValueAsType(Type tp, bool verbatim = false, bool strict = true)
Parameters
Type |
Name |
Description |
System.Type |
tp |
|
System.Boolean |
verbatim |
|
System.Boolean |
strict |
|
Returns
Type |
Description |
System.Object |
|
ValueAsUInt(UInt32, Boolean)
Declaration
public uint ValueAsUInt(uint dflt = 0U, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.UInt32 |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.UInt32 |
|
ValueAsULong(UInt64, Boolean)
Declaration
public ulong ValueAsULong(ulong dflt = 0UL, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.UInt64 |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.UInt64 |
|
ValueAsUShort(UInt16, Boolean)
Declaration
public ushort ValueAsUShort(ushort dflt = 0, bool verbatim = false)
Parameters
Type |
Name |
Description |
System.UInt16 |
dflt |
|
System.Boolean |
verbatim |
|
Returns
Type |
Description |
System.UInt16 |
|
Explicit Interface Implementations
IConfigNode.Parent
Declaration
IConfigSectionNode IConfigNode.Parent { get; }
Returns
IConfigNode.RootPath
Declaration
string IConfigNode.RootPath { get; }
Returns
Type |
Description |
System.String |
|
Implements
Extension Methods