Bloom.Book.BookData.GetVariableOrNull C# (CSharp) Method

GetVariableOrNull() public method

public GetVariableOrNull ( string key, string writingSystem ) : string
key string
writingSystem string
return string
        public string GetVariableOrNull(string key, string writingSystem)
        {
            var f= _dataset.TextVariables.ContainsKey(key)
                       ? _dataset.TextVariables[key].TextAlternatives[writingSystem]
                       : null;

            if (string.IsNullOrEmpty(f))//the TextAlternatives thing gives "", whereas we want null
                return null;
            return f;
        }

Usage Example

Example #1
0
 public void Constructor_CollectionSettingsHasCountrProvinceDistrict_LanguageLocationFilledIn()
 {
     //            var dom = new HtmlDom(@"<html><head><div id='bloomDataDiv'>
     //                    <div data-book='country'>the country</div>
     //                    <div data-book='province'>the province</div>
     //                    <div data-book='district'>the district</div>
     //            </div></head><body></body></html>");
     var dom = new HtmlDom();
     var data = new BookData(dom, new CollectionSettings(){Country="the country", Province = "the province", District= "the district"}, null);
     Assert.AreEqual("the district, the province<br/>the country", data.GetVariableOrNull("languageLocation", "*"));
 }
All Usage Examples Of Bloom.Book.BookData::GetVariableOrNull