public KeyTerm ToTerm(string text, string name) { KeyTerm term; if (KeyTerms.TryGetValue(text, out term)) { //update name if it was specified now and not before if (string.IsNullOrEmpty(term.Name) && !string.IsNullOrEmpty(name)) { term.Name = name; } return(term); } //create new term if (!CaseSensitive) { text = text.ToLowerInvariant(); } #if !SILICONSTUDIO_RUNTIME_CORECLR && !SILICONSTUDIO_PLATFORM_UWP text = string.Intern(text); #endif term = new KeyTerm(text, name); KeyTerms[text] = term; return(term); }
public KeyTerm ToTerm(string text, string name) { KeyTerm term; if (KeyTerms.TryGetValue(text, out term)) { //update name if it was specified now and not before if (string.IsNullOrEmpty(term.Name) && !string.IsNullOrEmpty(name)) { term.Name = name; } return(term); } //create new term if (!CaseSensitive) #if NETSTANDARD { text = text.ToLowerInvariant(); } #else { text = text.ToLower(CultureInfo.InvariantCulture); } string.Intern(text); #endif term = new KeyTerm(text, name); KeyTerms[text] = term; return(term); }
public KeyTerm ToTerm(string text, string name) { KeyTerm term; if (KeyTerms.TryGetValue(text, out term)) { //update name if it was specified now and not before if (string.IsNullOrEmpty(term.Name) && !string.IsNullOrEmpty(name)) term.Name = name; return term; } //create new term if (!CaseSensitive) text = text.ToLower(); string.Intern(text); term = new KeyTerm(text, name); KeyTerms[text] = term; return term; }
public KeyTerm ToTerm(string termValue, string name) { KeyTerm term; if (KeyTerms.TryGetValue(termValue, out term)) { //update name if it was specified now and not before if (string.IsNullOrEmpty(term.Name) && !string.IsNullOrEmpty(name)) { term.Name = name; } return(term); } //create new term if (!CaseSensitive) { termValue = termValue.ToLowerInvariant(); } term = new KeyTerm(termValue, name); KeyTerms[termValue] = term; return(term); }