static void Main()
        {
            ArrayList newCollection = new ArrayList(
            new string[] {"a", "new", "collection"} );

             // strings is directly replaced with newCollection.
             WritableCollection collection = new WritableCollection();
             collection.SomeStrings = newCollection;

             // newCollection is added to the cleared strings collection.
             collection.SomeStrings.Clear();
             collection.SomeStrings.AddRange(newCollection);
        }
Пример #2
0
        static void Main()
        {
            ArrayList newCollection = new ArrayList(
                new string[] { "a", "new", "collection" });

            // strings is directly replaced with newCollection.
            WritableCollection collection = new WritableCollection();

            collection.SomeStrings = newCollection;

            // newCollection is added to the cleared strings collection.
            collection.SomeStrings.Clear();
            collection.SomeStrings.AddRange(newCollection);
        }