• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MyList的典型用法代码示例。如果您正苦于以下问题:C# MyList类的具体用法?C# MyList怎么用?C# MyList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MyList类属于命名空间,在下文中一共展示了MyList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Test13Second

        public void Test13Second()
        {
            MyList<MyPoint> set1 = new MyList<MyPoint>();
            set1.Add(new MyPoint(8, 4));
            set1.Add(new MyPoint(9, 6));
            set1.Add(new MyPoint(1, 6));
            set1.Add(new MyPoint(2, 6));
            set1.Add(new MyPoint(5, 6));
            set1.Add(new MyPoint(3, 6));
            set1.Add(new MyPoint(6, 6));
            set1.Add(new MyPoint(7, 5));
            set1.Add(new MyPoint(8, 5));
            set1.Add(new MyPoint(3, 7));
            set1.Add(new MyPoint(6, 4));
            set1.Add(new MyPoint(6, 5));
            set1.Add(new MyPoint(2, 5));

            ResultCollection2 res = Solution.CalculatePoints(set1).GetBestSet(4);
            int val = res.ResultSet.Count;
            int permute = 0;
            Assert.IsTrue(val > 0);
            int c = res.ResultSet[0].Count;
            for (int i = 0; i < val; ++i)
            {
                Assert.AreEqual(c, res.ResultSet[i].Count, "Result sets are not all the same size");
                permute += res.ResultSet[i].Permutations;
            }

            Assert.AreEqual(36, val);
            Assert.AreEqual(864, permute);
        }
开发者ID:pauladrianfrench,项目名称:InterviewStreet,代码行数:31,代码来源:CalcTests.cs


示例2: Main

        static void Main(string[] args)
        {
            MyList<string> test = new MyList<string>(7);
            test.Add("lol0");
            test.Add("lol2");
            test.Add("lol1");
            Console.WriteLine("lol0 "+test.GetElementByIndex(0));
            Console.WriteLine("lol2 " + test.GetElementByIndex(1));
            Console.WriteLine("lol1 " + test.GetElementByIndex(2));
            Console.WriteLine("lol1 " + test.GetLastElement());
            test.RemoveLastElement();
            Console.WriteLine("lol2 " + test.GetLastElement());
            Console.WriteLine("2 "+test.getCount());
            test.RemoveFirstElement();
            Console.WriteLine("lol2 "+test.GetLastElement());
            Console.WriteLine("1 "+test.getCount());
            test.InsertElementAt(0, "lol2");
            Console.WriteLine("lol2 " + test.GetLastElement());
            test.InsertElementAt(1, "lol3");
            test.InsertElementAt(1, "lol4");
            Console.WriteLine("4 " +test.getCount());
            test.RemoveLastElement();
            Console.WriteLine("lol3 "+test.GetLastElement());
            test.RemoveLastElement();
            Console.WriteLine("lol4 " + test.GetLastElement());

            foreach (var item in test)
            {
                Console.WriteLine(item);
            }

            Console.Read();
        }
开发者ID:pareion,项目名称:TonsOfFun,代码行数:33,代码来源:Program.cs


示例3: testAs4

 public void testAs4()
 {
     var x = new MyList();
     AssertNotNull(AsIEnumerable(x));
     AssertNotNull(AsICollection(x));
     AssertNotNull(AsIList(x));
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:7,代码来源:TestNonCastSpecial.cs


示例4: Main

        static void Main(string[] args)
        {
            MyList<int> mylist = new MyList<int>();
            mylist.Add(213);
            mylist.Add(13);
            mylist.Add(1);
            mylist.Add(23);
            mylist.Insert(1,2);
            mylist.RemoveAt(4);
            mylist[0] = 100;
            for (int i = 0; i < mylist.Count; i++)
            {
                //Console.WriteLine(mylist.GetItem(i));
                Console.WriteLine(mylist[i]);
            }
            Console.WriteLine(mylist.IndexOf(13));
            Console.WriteLine(mylist.LastIndexOf(2));
            mylist.Sort();
            for (int i = 0; i < mylist.Count; i++)
            {
                //Console.WriteLine(mylist.GetItem(i));
                Console.WriteLine(mylist[i]);
            }

            Console.ReadKey();
        }
开发者ID:vin120,项目名称:c-shap-code,代码行数:26,代码来源:Program.cs


示例5: A43_Load

        private void A43_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            MyList<string> list = new MyList<string>();
            list.Add(isPT() ? "Gasolina" : "Nafta");
            list.Add(isPT() ? "Diesel" : "Diesel");
            list.Add(isPT() ? "GLP/ Gas Licuado de Petróleo más nafta" : "GLP/Gás de petróleo liquefeito mais gasolina");
            list.Add(isPT() ? "GNV/Gás Natural Veicular mais gasolina" : "GNC/ Gas Natural Comprimido más nafta");
            list.Add(isPT() ? "GNV/Gás Natural Veicular" : "GNC/ Gas natural Comprimido");
            list.Add(isPT() ? "GNV/Gás Natural Veicular mais diesel" : "GNC/ Gas Natural Comprimido másdiesel");
            list.Add(isPT() ? "Flex-fuel total flex: etanol e gasolina ou uma mistura dos dois" : "Combustible flexible (Flex Fuel)/vehículo totalflex: etanol y nafta ouna mezcla delas anteriores");
            list.Add(isPT() ? "Biodiesel" : "Biodiesel");
            list.Add(isPT() ? "Bioetanol" : "Bioetanol");

            list.Add(isPT() ? "Motor totalmente elétrico" : "Transmisióntotalmente eléctrica");
            list.Add(isPT() ? "Motor híbrido combinado com diesel" : "Motor híbrido combinado con diesel");
            list.Add(isPT() ? "Motor híbrido combinado com gasolina" : "Motor híbrido combinado con nafta");
            list.Add(isPT() ? "Célula de combustível" : "Pila de combustible");

            MyList<string> listVisiveis = new MyList<string>();

            listVisiveis.AddRange(new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14" });

            class_A.Lista = list;
            class_A.Visiveis = listVisiveis;
        }
开发者ID:kamikazebr,项目名称:Questionario,代码行数:30,代码来源:A43.cs


示例6: testIs4

 public void testIs4()
 {
     var x = new MyList();
     AssertTrue(IsIEnumerable(x));
     AssertTrue(IsICollection(x));
     AssertTrue(IsIList(x));
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:7,代码来源:TestNonCastSpecial.cs


示例7: should_Add_Single_Item_To_MyList_Instance

 public void should_Add_Single_Item_To_MyList_Instance()
 {
     var myList = new MyList();
     myList.Add(1);
     Assert.AreEqual(1,myList.Count);
     Assert.AreEqual(1,myList.Capacity);
 }
开发者ID:BrydenJ,项目名称:JourneymanCoursePrework,代码行数:7,代码来源:MyListTest.cs


示例8: A37_Load

        private void A37_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }
            string msg = isPT() ? String.Format("Com que tipo de gasolina o(a) Sr(a). geralmente abastece seu {0}?", rowCurrent["A4_A_NOME"]) : String.Format("¿Con qué tipo de nafta reabastece normalmente su {0}?", rowCurrent["A4_A_NOME"]);
            Label3.Text = msg;

            MyList<string> list = new MyList<string>();
            list.Add(isPT() ? "Petrobras: 101.5 octanas" : "Petrobras: 101.5 octanos");
            list.Add(isPT() ? "YPF fangio XXI: 98 octanas" : "YPF fangio XXI: 98 octanos");
            list.Add(isPT() ? "SHELL V-Power: 97,5 octanas" : "SHELL V-Power: 97.5 octanos");
            list.Add(isPT() ? "SUPER: 93,5 a 95 octanas" : "SUPER: 93.5 a 95 octanos");
            list.Add(isPT() ? "Comum: 83 a 85 octanas" : "Común: 83 a85 octanos");
            list.Add(isPT() ? "Gasolina comum: 87 octanas" : "Nafta común: 87 octanos");
            list.Add(isPT() ? "Gasolina Aditiva Supra: 87 octanas (+ aditivos)" : "Nafta Aditiva Supra: 87 octanos (+ aditivitos)");
            list.Add(isPT() ? "Gasolina Premium: 91 octanas" : "Nafta Premium: 91 octanos");
            list.Add(isPT() ? "Gasolina Podium: 95 octanas" : "NaftaPodium: 95 octanos");

            MyList<string> listVisiveis = new MyList<string>();

            if (isPT())
            {
                listVisiveis.AddRange(new string[] { "6", "7", "8", "9"});
            }
            else
            {
                listVisiveis.AddRange(new string[] { "1", "2", "3", "4", "5"});
            }

            //listVisiveis.Shuffle();
            class_A.Lista = list;
            class_A.Visiveis = listVisiveis;
        }
开发者ID:kamikazebr,项目名称:Questionario,代码行数:35,代码来源:A37.cs


示例9: OutputResults2

        //public void OutputResults(ResultCollection res)
        //{
        //    int count = 0;
        //    foreach (Results r in res.ResultSet)
        //    {
        //        Console.WriteLine("Result set {0}", ++count);
        //        Console.WriteLine("Permutuations: {0}", r.Permutations);
        //        foreach (Line l in r.Lines)
        //        {
        //            Console.Write("Line: ");
        //            foreach (MyPoint p in l.Points)
        //            {
        //                Console.Write("({0}, {1}) ", p.X, p.Y);
        //            }
        //            Console.WriteLine();
        //        }
        //        Console.WriteLine();
        //    }
        //    Console.Read();
        //}
        public void OutputResults2(MyList<MyPoint> set1, ResultCollection2 res)
        {
            int count = 0;
            for (int k = 0; k < res.ResultSet.Count; k++)
            {
                Results2 r = res.ResultSet[k];
                Console.WriteLine("Result set {0}", ++count);
                Console.WriteLine("Permutuations: {0}", r.Permutations);
                int c = r.Count;
                for (int j = 0; j < c; j++)
                {
                    ItemSet l = r.GetLine(j);
                    if (r.Count == 1)
                    {
                        Console.WriteLine("Emergency");
                    }
                    Console.Write("Line: ");

                    for (int i = 0; i < l.Count; i++)
                    {
                        Console.Write("({0}, {1}) ", l.GetItem(set1, i).X, l.GetItem(set1, i).Y);
                    }

                    Console.WriteLine();
                }
                Console.WriteLine();
            }
            Console.Read();
        }
开发者ID:pauladrianfrench,项目名称:InterviewStreet,代码行数:49,代码来源:UnitTests.cs


示例10: GetCastling

        public MyList<Position> GetCastling()
        {
            MyList<Position> castling = new MyList<Position>();
            Figure fig;
            int x = Position.GetX();
            if (ismoved())
                return castling;
            Side oppside = GetEnemySide();
            int ypos = (this.Side == Side.White) ? 1 : 8;
            if (chessfield.isDangerPosition(oppside, Position))
                return castling;

            fig = chessfield.GetFigureAt(new Position(1, ypos));
            if (fig != null &&
                !chessfield.isDangerPosition(oppside, new Position(x-1,ypos))    &&
                !chessfield.isDangerPosition(oppside, new Position(x - 2, ypos)) &&
                !chessfield.isDangerPosition(oppside, new Position(x - 3, ypos)) &&
                !chessfield.isDangerPosition(oppside, new Position(x, ypos)) &&
                !fig.ismoved() &&
                chessfield.GetFigureAt(new Position(2, ypos)) == null &&
                chessfield.GetFigureAt(new Position(3, ypos)) == null &&
                chessfield.GetFigureAt(new Position(4, ypos)) == null)
                                castling.Add(fig.Position);

             fig = chessfield.GetFigureAt(new Position(8, ypos));
             if (fig != null &&
                 !chessfield.isDangerPosition(oppside, new Position(x + 1, ypos)) &&
                 !chessfield.isDangerPosition(oppside, new Position(x + 2, ypos)) &&
                 !chessfield.isDangerPosition(oppside, new Position(x, ypos)) &&
                 !fig.ismoved() &&
                 chessfield.GetFigureAt(new Position(7, ypos)) == null &&
                 chessfield.GetFigureAt(new Position(6, ypos)) == null)
                    castling.Add(fig.Position);
            return castling;
        }
开发者ID:peleccom,项目名称:chess,代码行数:35,代码来源:King.cs


示例11: Main

 static void Main(string[] args)
 {
     MyList<int> List = new MyList<int>();
     List.AddElem(10);
     List.AddElem(15);
     List.AddElem(20);
 }
开发者ID:kyzya30,项目名称:HW_Generics_25.08.15,代码行数:7,代码来源:Program.cs


示例12: Main

  public static void Main(String[] args) 
  {
    Console.WriteLine ("Fill MyList object with content\n");
    MyList l = new MyList();
    for (int x=0; x< 10; x++) 
    {
      Console.WriteLine (x);
      l.Add (x);
    } // end for
    Console.WriteLine("\nSerializing object graph to file {0}", FILENAME);
    Stream outFile = File.Open(FILENAME, FileMode.Create, FileAccess.ReadWrite);
    BinaryFormatter outFormat = new BinaryFormatter();
    outFormat.Serialize(outFile, l);
    outFile.Close();
    Console.WriteLine("Finished\n");

    Console.WriteLine("Deserializing object graph from file {0}", FILENAME);
    Stream inFile = File.Open(FILENAME, FileMode.Open, FileAccess.Read);
    BinaryFormatter inFormat = new BinaryFormatter();
    MyList templist = (MyList)inFormat.Deserialize(inFile);
    Console.WriteLine ("Finished\n");
    
    foreach (MyListItem mli in templist) 
    {
      Console.WriteLine ("List item number {0}, square root {1}", mli.Number, mli.Sqrt);
    } //foreach

    inFile.Close();
  } // end main
开发者ID:ArildF,项目名称:masters,代码行数:29,代码来源:simpleserialize.cs


示例13: Main

        static void Main(string[] args)
        {
            MyList<int> generic_int = new MyList<int>();
            generic_int.Add(-1);
            generic_int.Add(2);
            generic_int.Add(3);

            MyList<float> genfloat = new MyList<float>();
            genfloat.Add(2.45f);
            genfloat.Add(2.46f);
            genfloat.Add(2.47f);
            genfloat.Add(2.48f);
            genfloat.Add(2.49f);
            Console.WriteLine("Друкуемо раз:");
            foreach (var item in generic_int)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("Друкуемо два:");
            foreach (var item in genfloat)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine(generic_int.IndexOf(2));
            generic_int.Remove(2);
            Console.WriteLine(generic_int.IndexOf(2));
            Console.WriteLine("Писля удаления:");
            foreach (var item in generic_int)
            {
                Console.WriteLine(item);
            }

        }
开发者ID:antixaker,项目名称:MyRepository,代码行数:33,代码来源:Program.cs


示例14: GetInMoveAttacks

        /// <summary>
        /// Вернет список бьющихся фигур на проходе
        /// </summary>
        /// <returns></returns>
        public MyList<Position> GetInMoveAttacks()
        {
            int delta = (Side == Side.Black) ? +1 : -1;
            Position pos;
            Side oppside = GetEnemySide();
            Figure fig;
            MyList<Position> moves = new MyList<Position>();
            foreach (Position attack in GetAttacks())
            {
                try{
                    pos = new Position(attack.GetX(), attack.GetY() + delta);
                    fig = chessfield.GetFigureAt(pos);
                    if (fig != null && fig.GetFigureType() == FigureTypes.Pawn &&
                        fig.Side == oppside &&
                        chessfield.GetlastMoved(oppside) == fig)
                        moves.Add(pos);
                    {

                    }

                }
                catch {}

            }
            return moves;
        }
开发者ID:peleccom,项目名称:chess,代码行数:30,代码来源:Pawn.cs


示例15: Test16First

        public void Test16First()
        {
            MyList<MyPoint> set1 = new MyList<MyPoint>();
            set1.Add(new MyPoint(1, 6));
            set1.Add(new MyPoint(2, 6));
            set1.Add(new MyPoint(5, 6));
            set1.Add(new MyPoint(3, 6));
            set1.Add(new MyPoint(2, 5));
            set1.Add(new MyPoint(3, 5));
            set1.Add(new MyPoint(5, 5));
            set1.Add(new MyPoint(3, 4));
            set1.Add(new MyPoint(3, 7));
            set1.Add(new MyPoint(6, 4));
            set1.Add(new MyPoint(6, 5));
            set1.Add(new MyPoint(6, 6));
            set1.Add(new MyPoint(7, 5));
            set1.Add(new MyPoint(8, 5));
            set1.Add(new MyPoint(8, 4));
            set1.Add(new MyPoint(9, 6));

            ResultCollection2 res = Solution.CalculatePoints(set1);
            int val = res.ResultSet.Count;
            int permute = 0;
            Assert.IsTrue(val > 0);
            int c = res.ResultSet[0].Count;
            for (int i = 0; i < val; ++i)
            {
                Assert.AreEqual(c, res.ResultSet[i].Count);
                permute += res.ResultSet[i].Permutations;
            }

            Assert.AreEqual(8, val);
            Assert.AreEqual(192, permute);
        }
开发者ID:pauladrianfrench,项目名称:InterviewStreet,代码行数:34,代码来源:CalcTests.cs


示例16: SetUpList

 private void SetUpList()
 {
     List = new MyList
     {
         CreateModel()
     };
 }
开发者ID:jdoiwork,项目名称:WPF_Samples,代码行数:7,代码来源:MainViewModel.cs


示例17: GetAttacks

 public override MyList<Position> GetAttacks()
 {
     MyList<Position> l = new MyList<Position>();
     foreach (MovePolitics mp in attackpolitics)
             l.AddRange(mp.GetMoves(this, chessfield));
     return l;
 }
开发者ID:peleccom,项目名称:chess,代码行数:7,代码来源:Pawn.cs


示例18: DeleteBadTest

 public void DeleteBadTest()
 {
     MyList<int> list = new MyList<int>();
     list.AddToHead(10);
     list.AddToHead(9);
     list.Delete(4);
 }
开发者ID:EvgeneDudkin,项目名称:Homework,代码行数:7,代码来源:TestsInList.cs


示例19: ClearTest

 public void ClearTest()
 {
     MyList<int> list = new MyList<int>();
     list.AddToHead(10);
     list.Clear();
     Assert.IsTrue(list.Size() == 0);
 }
开发者ID:EvgeneDudkin,项目名称:Homework,代码行数:7,代码来源:TestsInList.cs


示例20: Main

        static void Main(string[] args)
        {
            var myList = new MyList<int>();

            int cnt = 11;
            for (int i = 0; i < cnt; i++)
            {
                myList.Add(i);
            }

            Console.WriteLine("List of elements: ");
            foreach (var item in myList)
            {
                Console.Write("{0}  ", item);
            }
            Console.WriteLine("| Count = {0}", myList.Count);

            myList.RemoveAt(5);
            myList.RemoveAt(5);
            myList.RemoveAt(5);

            Console.WriteLine("\nList of elements with removed elements: ");
            foreach (var item in myList)
            {
                Console.Write("{0}  ", item);
            }
            Console.WriteLine("| Count = {0}", myList.Count);

            Console.WriteLine("\nElement with index = 3:  {0}", myList[3]);

            Console.ReadKey();
        }
开发者ID:dmitriy1024,项目名称:HW_Generics,代码行数:32,代码来源:Program.cs



注:本文中的MyList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyLodTypeEnum类代码示例发布时间:2022-05-24
下一篇:
C# MyKeys类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap