Struct SealedString
Represents an immutable string data that is stored in an efficient way that relieves the GC pressure.
The string can not be changed or deleted. Once created it stays as-is until the process is terminated.
This structure is used to store much dictionary data (100s of millions of strings) in the process without causing GC overload.
Note: The default .ctor DOES NOT check whether the same string is already present in memory. Use SealedString.Scope to
store unique strings only (do not store the repetitions).
This struct is THREAD SAFE and NOT SERIALIZABLE.
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: NFX
Assembly: NFX.dll
Syntax
[SlimSerializationProhibited]
public struct SealedString : IEquatable<SealedString>
Constructors
SealedString(String)
Creates a sealed copy of string data. This .ctor DOES NOT check whether this string was already sealed
Declaration
public SealedString(string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
|
Fields
Address
Declaration
public readonly int Address
Field Value
| Type |
Description |
| System.Int32 |
|
Segment
Declaration
public readonly ushort Segment
Field Value
| Type |
Description |
| System.UInt16 |
|
Properties
IsAssigned
Returns true if this instance represents an assigned valid string (is not equal to Unassigned)
Declaration
public bool IsAssigned { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
TotalBytesAllocated
Returns the total number of bytes allocated
Declaration
public static long TotalBytesAllocated { get; }
Property Value
| Type |
Description |
| System.Int64 |
|
TotalBytesUsed
Returns the total number of bytes used
Declaration
public static long TotalBytesUsed { get; }
Property Value
| Type |
Description |
| System.Int64 |
|
TotalCount
Returns the total count of strings allocated
Declaration
public static long TotalCount { get; }
Property Value
| Type |
Description |
| System.Int64 |
|
TotalSegmentCount
Declaration
public static int TotalSegmentCount { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Unassigned
Returns a SealedString that is IsAssigned==false - a special invalid value
Declaration
public static SealedString Unassigned { get; }
Property Value
Value
Returns the original string copy
Declaration
public string Value { get; }
Property Value
| Type |
Description |
| System.String |
|
Methods
Equals(SealedString)
Declaration
public bool Equals(SealedString other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.ValueType.ToString()
Operators
Equality(SealedString, SealedString)
Declaration
public static bool operator ==(SealedString l, SealedString r)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Inequality(SealedString, SealedString)
Declaration
public static bool operator !=(SealedString l, SealedString r)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Implements
System.IEquatable<T>
Extension Methods