Show / Hide Table of Contents

Class LocalizableString

Provides methods of working with localized string.

Inheritance
System.Object
LocalizableValue
LocalizableValue<System.String>
LocalizableString
Implements
System.ICloneable
Inherited Members
LocalizableValue<String>.ResetCultureValues()
LocalizableValue<String>.HasAnyValue()
LocalizableValue<String>.LoadCultureValues()
LocalizableValue<String>.HasCultureValue(CultureInfo)
LocalizableValue<String>.SetCultureValue(CultureInfo, String)
LocalizableValue<String>.GetCultureValue(CultureInfo, Boolean)
LocalizableValue<String>.GetCultureValueWithFallback(CultureInfo, Boolean)
LocalizableValue<String>.ClearCultureValue(CultureInfo)
LocalizableValue<String>.Value
LocalizableValue<String>.HasValue
LocalizableValue<String>.CultureValues
LocalizableValue.SetResourceInfo(String, String, Boolean)
LocalizableValue.SetResourceInfo(IResourceStorage, String, String, Boolean)
LocalizableValue.Storage
LocalizableValue.ResourceManager
LocalizableValue.ResourceManagerName
LocalizableValue.ResourceItemName
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
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
LocalizableValue.Clone()

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

true, if the obj is of the LocalizableString type and its value matches with the value of current instance, otherwise false.

Overrides
System.Object.Equals(System.Object)
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

true if the value of the current LocalizableString instance matches the caption; otherwise – false.

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 culture.

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
Terrasoft.Common.LocalizableValue<System.String>.GetFromResourceManager(System.Globalization.CultureInfo, System.String)

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
Terrasoft.Common.LocalizableValue<System.String>.GetFromResourceManagerWithCultureFallback(System.Globalization.CultureInfo, System.String)

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
System.Object.GetHashCode()

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

true if the localized string localizableString is empty or null; otherwise - false.

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 target.

Returns
Type Description
LocalizableString

The LocalizableString instance that represents the result of merging two localized strings: target and source.

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
System.Object.ToString()

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

true if both operands are equivalent; otherwise - false.

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 value string.

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 localizableString localized string or null if localizableString is equal to null.

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

true if the operands are not equivalent; otherwise - false.

Implements

System.ICloneable

Extension Methods

ReflectionUtilities.GetPropertyValue(Object, String)
ReflectionUtilities.GetPropertyDefValue(Object, String, Object)
ReflectionUtilities.TryGetPropertyValue(Object, String, out Object)
ReflectionUtilities.HasProperty(Object, String)
ReflectionUtilities.GetPropertyValue(Object, String, BindingFlags)
ReflectionUtilities.GetPropertyValueByPath(Object, String)
ReflectionUtilities.SetPropertyValue(Object, String, Object)
ReflectionUtilities.TrySetPropertyValue(Object, String, Object)
ValidateUtilities.CheckArgumentNull(Object, String)
ValidateUtilities.CheckDependencyNull(Object, String)
ValidateUtilities.EnsureDependencyNotNull<T>(T, String)
CoreLocalizableString.ToDictionary(LocalizableString)
CoreLocalizableString.ToDictionary(LocalizableString, CultureInfo)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance, Boolean)
NSubstituteExtension.Protected(Object, String, Object[])
NSubstituteExtension.Protected(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedProperty(Object, String)
NSubstituteExtension.MatchInstance<T>(T)
SubstituteUtilities.GetIsSubstituteObject(Object)
SubstituteUtilities.Instead<TInstance, TValue>(TInstance, Func<TInstance, TValue>)
Back to top Generated by DocFX