Spontaneous.DataModel.Localized.GetDescription C# (CSharp) Метод

GetDescription() публичный Метод

public GetDescription ( CultureInfo lang ) : string
lang System.Globalization.CultureInfo
Результат string
        public string GetDescription(CultureInfo lang)
        {
            if (this.LocalizedList != null && this.LocalizedList.Count > 0)
            {
                LocalizedUnit descr = this.LocalizedList.FirstOrDefault(d => d.Language == lang.Name);
                if (descr != null) return descr.Value;
                else return null;
            }
            else return null;
        }

Same methods

Localized::GetDescription ( ) : string
Localized::GetDescription ( string lang ) : string

Usage Example

Пример #1
0
        public void Localized_UpdateDescription_IfDescriptionExistsUpdate_IfNotCreateNewOnThisLanguage()
        {
            //arrange
            Localized loc = new Localized("en-US", "White Rice with Corn");

            //act
            loc.UpdateDescription("en-US", "Potato");

            //Assert

            Assert.AreEqual(loc.GetDescription("en-US"), "Potato");
        }