C#根据长度创建数组

根据长度创建数组;

                    byte j = 0x00;
                    List<byte> iList = new List<byte>();
                    for (int i = 0; i < 18; i++)
                    {
                        Random rd = new Random();
                        do
                        {
                        j = rd.Next(1, 11);
                        } while (iList.Contains(j));
                        iList.Add(j);
                    }
                    

                    result = master.WriteMultiReg(Address, iList.ToArray());

 

posted @ 2021-03-16 11:39  Nanyingming  阅读(452)  评论(0编辑  收藏  举报