Class SealedString.Scope
Represents a scope of a SealedString creation that tracks the existing strings.
Use Seal(string) to get an existing string or create a new one.
Do not persist the instance of Scope for a long time as it accumulates references (string keys) that pressure the GC.
This class is used in batched that create many sealed strings. Once those strings rae created the scope can be released.
Inheritance
System.Object
SealedString.Scope
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)
System.Object.ToString()
Assembly: Azos.dll
Syntax
Constructors
Scope()
Create a Scope with InvariantCultureIgnoreCase comparer
Declaration
Scope(StringComparer)
Create a Scope with the specified comparer or InvariantCultureIgnoreCase comparer if the supplied one is null
Declaration
public Scope(StringComparer comparer)
Parameters
Type |
Name |
Description |
System.StringComparer |
comparer |
|
Properties
Count
Returns the number of unique strings in scope
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Item[String]
Returns a SealedString for an existing key in scope or SealedString.Unassigned for a non-exisiting string
Declaration
public SealedString this[string value] { get; }
Parameters
Type |
Name |
Description |
System.String |
value |
|
Property Value
Methods
Contains(String)
Returns true if a unique string is in the scope
Declaration
public bool Contains(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Boolean |
|
Seal(String)
Returns an existing SealedString instance for existing data or allocates a new one.
This method is thread-safe
Declaration
public SealedString Seal(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Seal(String, out Boolean)
Returns an existing SealedString instance for existing data or allocates a new one.
This method is thread-safe
Declaration
public SealedString Seal(string value, out bool existed)
Parameters
Type |
Name |
Description |
System.String |
value |
|
System.Boolean |
existed |
|
Returns
Extension Methods