/// <summary> /// Add the contents of the UnicodeSet (as strings) into a collection. /// </summary> /// <typeparam name="T">Collection type.</typeparam> /// <param name="set">This set.</param> /// <param name="target">Collection to add into.</param> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static T AddAllTo <T>(this UnicodeSet set, T target) where T : ICollection <string> { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.AddAllTo(target)); }
public void TestSetEquals() { // Initialize UnicodeSets var thaiWordSet = new UnicodeSet(); var thaiWordSet2 = new UnicodeSet(); var burmeseWordSet = new UnicodeSet(); burmeseWordSet.ApplyPattern("[[:Mymr:]&[:LineBreak=SA:]]"); burmeseWordSet.Compact(); thaiWordSet.ApplyPattern("[[:Thai:]&[:LineBreak=SA:]]"); thaiWordSet.Compact(); thaiWordSet2.ApplyPattern("[[:Thai:]&[:LineBreak=SA:]]"); thaiWordSet2.Compact(); assertTrue("UnicodeSet.SetEquals: The word sets are not equal", thaiWordSet.SetEquals(thaiWordSet2)); assertTrue("UnicodeSet.SetEquals: The word sets are not equal", thaiWordSet2.SetEquals(thaiWordSet)); assertFalse("UnicodeSet.SetEquals: The word sets are equal", thaiWordSet.SetEquals(burmeseWordSet)); var equivSet = new List <string>(); thaiWordSet.AddAllTo(equivSet); assertTrue("UnicodeSet.SetEquals: The word sets are not equal", thaiWordSet.SetEquals(equivSet)); }