示例#1
0
        public void IndexOf()
        {
            _tableMapCollection.AddRange(_tabs);
            int ind;

            ind = _tableMapCollection.IndexOf(_tabs[0]);
            Assert.Equal(0, ind);
            ind = _tableMapCollection.IndexOf(_tabs[1]);
            Assert.Equal(1, ind);

            ind = _tableMapCollection.IndexOf(_tabs[0].SourceTable);
            Assert.Equal(0, ind);
            ind = _tableMapCollection.IndexOf(_tabs[1].SourceTable);
            Assert.Equal(1, ind);
        }
        public void IndexOf()
        {
            tableMapCollection.AddRange(tabs);
            int ind;

            ind = tableMapCollection.IndexOf(tabs[0]);
            Assert.AreEqual(0, ind, "test1");
            ind = tableMapCollection.IndexOf(tabs[1]);
            Assert.AreEqual(1, ind, "test2");

            ind = tableMapCollection.IndexOf(tabs[0].SourceTable);
            Assert.AreEqual(0, ind, "test3");
            ind = tableMapCollection.IndexOf(tabs[1].SourceTable);
            Assert.AreEqual(1, ind, "test4");
        }
示例#3
0
 // <Snippet1>
 public void FindDataTableMapping()
 {
     // ...
     // create mappings
     // ...
     if (!mappings.Contains("Categories"))
     {
         Console.WriteLine("Error: no such table in collection");
     }
     else
     {
         Console.WriteLine
             ("Name: " + mappings["Categories"].ToString() + "\n"
             + "Index: " + mappings.IndexOf("Categories").ToString());
     }
 }
示例#4
0
 // <Snippet1>
 public void ChangedMyMind()
 {
     // ...
     // create mappings and mapping
     // ...
     if (mappings.Contains((Object)mapping))
     {
         mappings.Remove((Object)mapping);
     }
     else
     {
         mappings.Add((Object)mapping);
         Console.WriteLine("Index of new mapping: "
                           + mappings.IndexOf((Object)mapping));
     }
 }