Class LocalizableString
Provides methods of working with localized string.
Implements
Inherited Members
Namespace: Terrasoft.Common
Assembly: Terrasoft.Common.dll
Syntax
public class LocalizableString : LocalizableValue<string>, ICloneable
Constructors
LocalizableString()
Initializes a new instance of the LocalizableString class.
Declaration
public LocalizableString()
LocalizableString(String)
Initializes a new instance of the LocalizableString class using the specified string value.
Declaration
public LocalizableString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Value. |
LocalizableString(String, String)
Initializes a new instance of the LocalizableString class using the specified resource manager name and specified resource element name.
Declaration
public LocalizableString(string resourceManagerName, string resourceItemName)
Parameters
Type | Name | Description |
---|---|---|
System.String | resourceManagerName | Resource manager name. |
System.String | resourceItemName | Name of the resource item. |
LocalizableString(IResourceStorage, String, String)
Initializes a new instance of the LocalizableString class using the specified resource repository, resource manager name and specified resource element name.
Declaration
public LocalizableString(IResourceStorage storage, string resourceManagerName, string resourceItemName)
Parameters
Type | Name | Description |
---|---|---|
IResourceStorage | storage | A resource storage. |
System.String | resourceManagerName | Resource manager name. |
System.String | resourceItemName | Name of the resource item. |
LocalizableString(LocalizableString)
Initializes a copy of LocalizableString that was passed as source
parameter.
Declaration
public LocalizableString(LocalizableString source)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | source | Localizable string. |
Remarks
The constructor creates a new object, which is a copy of source
.
Properties
Empty
Gets an empty localized string.
Declaration
public static LocalizableString Empty { get; }
Property Value
Type | Description |
---|---|
LocalizableString |
Methods
Clone()
Creates a copy of the current LocalizableString instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new LocalizableString instance that represents the copy of the current instance. |
Overrides
Equals(Object)
Determines whether the given LocalizableString instance and the specified System.Object instance have the same values.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The System.Object instance for comparing with the current instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
Remarks
Overloaded method.
EqualsByValue(LocalizableString)
Determines whether the current and the specified LocalizableString instances have the same values.
Declaration
public bool EqualsByValue(LocalizableString caption)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | caption | The LocalizableString instance for comparing with the current instance LocalizableString. |
Returns
Type | Description |
---|---|
System.Boolean |
|
GetCultureValue(CultureInfo)
Gets string value of the current LocalizableString instance according to the specified culture. If the localized value is not set for the specified culture, a ItemNotFoundException exception is thrown.
Declaration
public string GetCultureValue(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | Regional and language settings. |
Returns
Type | Description |
---|---|
System.String | String, localized according to the culture specified in the |
Exceptions
Type | Condition |
---|---|
ItemNotFoundException | If localized value is not set for the specified culture. |
GetFromResourceManager(CultureInfo, String)
Declaration
protected override string GetFromResourceManager(CultureInfo culture, string itemName)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | |
System.String | itemName |
Returns
Type | Description |
---|---|
System.String |
Overrides
GetFromResourceManagerWithCultureFallback(CultureInfo, String)
Declaration
protected override string GetFromResourceManagerWithCultureFallback(CultureInfo culture, string itemName)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | |
System.String | itemName |
Returns
Type | Description |
---|---|
System.String |
Overrides
GetHashCode()
Gets hash code for the current localized string.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hash code for current instance LocalizableString in the form of 32-bit signed integer. |
Overrides
IsNullOrEmpty(LocalizableString)
Determines if the set localized string is empty or null
.
Declaration
public static bool IsNullOrEmpty(LocalizableString localizableString)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | localizableString | Localizable string. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Merge(LocalizableString, LocalizableString)
Combines the specified localized strings.
Declaration
public static LocalizableString Merge(LocalizableString target, LocalizableString source)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | target | Localized string to combine with. |
LocalizableString | source | Localized string combined with |
Returns
Type | Description |
---|---|
LocalizableString | The LocalizableString instance that represents the result of merging two localized strings: |
ToString()
Converts localized string value of the current instance to an equivalent System.String instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | An instance of the System.String class that is equivalent to the current localized string. |
Overrides
Operators
Equality(LocalizableString, LocalizableString)
Implements the “equal” operator (==) of the two localized strings.
Declaration
public static bool operator ==(LocalizableString op1, LocalizableString op2)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | op1 | Operand 1. |
LocalizableString | op2 | Operand 2. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Implicit(String to LocalizableString)
Performs an implicit conversion of the System.String type to the LocalizableString type.
Declaration
public static implicit operator LocalizableString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The System.String type instance for conversion. |
Returns
Type | Description |
---|---|
LocalizableString | The LocalizableString instance, equivalent to the |
Implicit(LocalizableString to String)
Performs an implicit conversion of the LocalizableString type to the System.String type.
Declaration
public static implicit operator string (LocalizableString localizableString)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | localizableString | The LocalizableString type instance for conversion. |
Returns
Type | Description |
---|---|
System.String | The System.String instance equivalent to the |
Inequality(LocalizableString, LocalizableString)
Implements the “not equal” operator (!=) of the two localized strings.
Declaration
public static bool operator !=(LocalizableString op1, LocalizableString op2)
Parameters
Type | Name | Description |
---|---|---|
LocalizableString | op1 | Operand 1. |
LocalizableString | op2 | Operand 2. |
Returns
Type | Description |
---|---|
System.Boolean |
|