当前位置: 首页>>代码示例>>C#>>正文


C# System.Collections.Generic.List.ToArray方法代码示例

本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.ToArray方法的具体用法?C# System.Collections.Generic.List.ToArray怎么用?C# System.Collections.Generic.List.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Generic.System.Collections.Generic.List的用法示例。


在下文中一共展示了System.Collections.Generic.List.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RandomTest

        public void RandomTest()
        {
            RingBuffer<int> TestObject = new RingBuffer<int>(10);
            Utilities.Random.Random Rand = new Utilities.Random.Random();
            int Value = 0;
            for (int x = 0; x < 10; ++x)
            {
                Value = Rand.Next();
                TestObject.Add(Value);
                Assert.Equal(1, TestObject.Count);
                Assert.Equal(Value, TestObject.Remove());
            }
            Assert.Equal(0, TestObject.Count);
            System.Collections.Generic.List<int> Values=new System.Collections.Generic.List<int>();
            for (int x = 0; x < 10; ++x)
            {
                Values.Add(Rand.Next());
            }
            TestObject.Add(Values);
            Assert.Equal(Values.ToArray(), TestObject.ToArray());

            for (int x = 0; x < 10; ++x)
            {
                Assert.Throws<IndexOutOfRangeException>(() => TestObject.Add(Rand.Next()));
                Assert.Equal(10, TestObject.Count);
            }
        }
开发者ID:gwilkinson,项目名称:Craig-s-Utility-Library,代码行数:27,代码来源:RingBuffer.cs

示例2: CancelaCFDI

        public ICancelaResponse CancelaCFDI(string user, string password, string rfc, string[] uuid, byte[] pfx, string pfxPassword) {
            //return this.cancelaCFDi(user, password, rfc, uuid, pfx, pfxPassword);

            CancelaResponse response = this.cancelaCFDi(user, password, rfc, uuid, pfx, pfxPassword);

            CancelaResponseBase responseBase = new CancelaResponseBase();
            responseBase.Ack = response.ack;
            responseBase.Text = response.text;

            System.Collections.Generic.List<string> uuidsList = new System.Collections.Generic.List<string>();

            foreach (string uuidItem in response.uuids) {
                uuidsList.Add(uuidItem);
            }
            responseBase.UUIDs = uuidsList.ToArray();

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(response.GetType());
            MemoryStream ms = new MemoryStream();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Encoding = new UTF8Encoding();
            XmlWriter xmlWriter = XmlWriter.Create(ms, settings);
            x.Serialize(xmlWriter, response);
            string xmlContent = Encoding.UTF8.GetString(ms.GetBuffer());

            responseBase.XmlResponse = xmlContent;

            return responseBase;
        }
开发者ID:thorvictor,项目名称:SistrategiaCFDi,代码行数:28,代码来源:CFDiService.cs

示例3: testBasicStructure

        public void testBasicStructure()
        {
            Being b = new Being();
            b.Ident = "ALASTAIR";
            b.RightEye = new BeingEye();
            b.RightEye.EyeState = EyeState.FIXATION;
            b.RightEye.GazeVector = new Pose6D();
            CommunicationHelper.setPose6D( b.RightEye.GazeVector, 23.5678549M, 92.64654864M, null, 45.765234560M, 60.34444124365M, null, 0.9M );

            GazeTrackData gt = new GazeTrackData();
            gt.Timestamp = DateTime.UtcNow;
            gt.SequenceNumber = 0;
            System.Collections.Generic.List<Being> beingList = new System.Collections.Generic.List<Being>();
            beingList.Add( b );
            gt.Beings = beingList.ToArray();

            System.Collections.Generic.List<GazeTrackData> gazeTrackDataList = new System.Collections.Generic.List<GazeTrackData>();
            gazeTrackDataList.Add( gt );

            GazeTrackDataSet gtd = new GazeTrackDataSet();
            gtd.GazeTrackData = gazeTrackDataList.ToArray();

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer( gtd.GetType() );
            TextWriter writer = new SpecificEncodingStringWriter( Encoding.UTF8 );
            XmlWriter xmlWriter = XmlWriter.Create( writer );
            x.Serialize( xmlWriter, gtd );
            Console.WriteLine( "XML:" );
            Console.WriteLine( writer.ToString() );
            Console.WriteLine( "Length: " + writer.ToString().Length );
            log.Debug( "Generated XML" );
            log.Debug( writer.ToString() );
            log.Debug( "Generated XML Length: " + writer.ToString().Length );
        }
开发者ID:jonbyte,项目名称:EyeSpark,代码行数:33,代码来源:XmlStructureTest.cs

示例4: Notify

        public void Notify(params object[] args)
        {
            if (args != null && args.Length != 0 && args[0] is EntityEvent)
            {
                BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey;
                if (!(key == null))
                {
                    Customer customer = key.GetEntity() as Customer;
                    if (PubHelper.IsOrg_Customer2DMS(customer))
                    {
                        bool flag = PubHelper.IsUsedDMSAPI();
                        if (flag)
                        {
                            //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006"))
                            //    || (customer.CustomerCategory != null
                            //        && customer.CustomerCategory.DescFlexField != null
                            //        && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool()
                            //        )
                            //    )
                            if(
                                PubHelper.IsUpdateDMS(customer)
                                )
                            {
                                try
                                {
                                    SI08ImplService service = new SI08ImplService();
                                    // service.Url = PubHelper.GetAddress(service.Url);
                                    System.Collections.Generic.List<dealerInfoDto> list = new System.Collections.Generic.List<dealerInfoDto>();
                                    dealerInfoDto dto = new dealerInfoDto();
                                    dto.dealerCode = customer.Code;
                                    dto.dealerName = customer.Name;
                                    dto.dealerShortName = customer.ShortName;
                                    dto.companyCode = customer.Code;
                                    dto.companyName = customer.Name;
                                    dto.companyShortName = customer.ShortName;
                                    if (customer.CustomerCategoryKey != null)
                                    {
                                        dto.dealerType = int.Parse(customer.CustomerCategory.Code);
                                    }
                                    dto.actionType = 3;
                                    // status  100201 有效 100202 无效
                                    dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202";

                                    list.Add(dto);
                                    dealerInfoDto d = service.Do(list.ToArray());
                                    if (d != null && d.flag == 0)
                                    {
                                        throw new System.ApplicationException(d.errMsg);
                                    }
                                }
                                catch (System.Exception e)
                                {
                                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:HaiBoHan,项目名称:HBHDaYunsy,代码行数:60,代码来源:CustomerDeleted.cs

示例5: GetParticipantProviders

        public static Type[] GetParticipantProviders()
        {

            var type = typeof(ParticipantProviderBase);
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();
            System.Collections.Generic.List<Type> providerTypes = new System.Collections.Generic.List<Type>();
            foreach (Assembly assembly in assemblies)
            {
                try
                {
                    foreach (var assemblyType in assembly.GetTypes())
                    {
                        try
                        {
                            if (type.IsAssignableFrom(assemblyType) && type != assemblyType)
                                providerTypes.Add(assemblyType);
                        }
                        catch (Exception ex)
                        {

                        }

                    }
                }
                catch (Exception e)
                {

                }
            }

            return providerTypes.ToArray<Type>();

        }
开发者ID:BVNetwork,项目名称:Attend,代码行数:33,代码来源:ParticipantProviderManager.cs

示例6: GetState

 protected override object GetState()
 {
     System.Collections.Generic.List<Tuple<string, decimal, string, decimal>> list = new System.Collections.Generic.List<Tuple<string, decimal, string, decimal>>();
     foreach (SpreadEntryPanel spreadEntryPanel in this.SpreadEntryPanelTableLayout.Controls)
     {
         list.Add(spreadEntryPanel.GetState());
     }
     return list.ToArray();
 }
开发者ID:jinpan,项目名称:Traders_IAP,代码行数:9,代码来源:SpreadEntry.cs

示例7: StringToArray

 /// <summary>
 /// Strings to array.
 /// </summary>
 /// <returns>The to array.</returns>
 /// <param name="str">String.</param>
 public static uint[] StringToArray(string str)
 {
     var stra = str.Split (new char[]{ ',', ';', '|' }, StringSplitOptions.RemoveEmptyEntries);
     var ints = new System.Collections.Generic.List<uint> ();
     foreach (string s in stra) {
         uint i;
         uint.TryParse (s, out i);
         ints.Add (i);
     }
     return ints.ToArray ();
 }
开发者ID:Onkeliroh,项目名称:DSA,代码行数:16,代码来源:ConfigHelper.cs

示例8: GetSignature

        public static string GetSignature(string appkey, string appsecret,
        string userID)
        {
            System.Collections.Generic.List<string> arr = new System.Collections.Generic.List<string>();
            arr.Add(appkey.ToLower());
            arr.Add(appsecret.ToLower());
            arr.Sort();
            string appinfo = string.Join(string.Empty, arr.ToArray());

            appinfo = GetMd5(appinfo).ToLower();

            arr.Clear();
            arr.Add(appinfo);
            arr.Add(userID.ToLower());
            arr.Sort();

            string signature = string.Join(string.Empty, arr.ToArray());
            signature = GetSha1(signature).ToLower();

            return signature;
        }
开发者ID:yunxiaokeji,项目名称:IntFactory,代码行数:21,代码来源:Signature.cs

示例9: Notify

        public void Notify(params object[] args)
        {
            if (args != null && args.Length != 0 && args[0] is EntityEvent)
            {
                BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey;
                if (!(key == null))
                {
                    Customer customer = key.GetEntity() as Customer;
                    if (PubHelper.IsOrg_Customer2DMS(customer))
                    {
                        bool flag = PubHelper.IsUsedDMSAPI();
                        if (flag)
                        {
                            if (customer.CustomerCategoryKey == null)
                            {
                                throw new System.ApplicationException("分类不可为空");
                            }
                            //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006"))
                            //    || (customer.CustomerCategory != null
                            //        && customer.CustomerCategory.DescFlexField != null
                            //        && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool()
                            //        )
                            //    )
                            if (
                                PubHelper.IsUpdateDMS(customer)
                                )
                            {
                                try
                                {
                                    SI08ImplService service = new SI08ImplService();
                                    // service.Url = PubHelper.GetAddress(service.Url);
                                    System.Collections.Generic.List<dealerInfoDto> list = new System.Collections.Generic.List<dealerInfoDto>();

                                    dealerInfoDto dto = GetUpdateDMSDTO(customer);

                                    list.Add(dto);
                                    dealerInfoDto d = service.Do(list.ToArray());
                                    if (d != null && d.flag == 0)
                                    {
                                        throw new System.ApplicationException(d.errMsg);
                                    }
                                }
                                catch (System.Exception e)
                                {
                                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:HaiBoHan,项目名称:HBHDaYunsy,代码行数:52,代码来源:CustomerUpdated.cs

示例10: fp_discover_devs_structus

        public static fp_dscv_dev[] fp_discover_devs_structus(out IntPtr arrayPtr)
        {
            var devices = new System.Collections.Generic.List<fp_dscv_dev>();
            var devicePtrs = fp_discover_devs_pointers(out arrayPtr);

            foreach (var devicePtr in devicePtrs)
            {
                var device = devicePtr.DereferencePtr<fp_dscv_dev>();
                devices.Add(device);
            }

            return devices.ToArray();
        }
开发者ID:ranma42,项目名称:libfprint-cs,代码行数:13,代码来源:Interop.cs

示例11: RandomBytes

        public static byte[] RandomBytes(int min, int max)
        {
            Random random = new Random();
            System.Collections.Generic.List<byte> randomAsset = new System.Collections.Generic.List<byte>();
            int numBytes = random.Next(min, max);

            for (int i = 0; i < numBytes; i++)
            {
                randomAsset.Add((byte)Math.Floor(26 * random.NextDouble() + 65));
            }

            return randomAsset.ToArray();
        }
开发者ID:zwagoth,项目名称:whip-dotnet-client,代码行数:13,代码来源:TestUtil.cs

示例12: GetAllDerivedTypes

 public static System.Type[] GetAllDerivedTypes(this System.AppDomain aAppDomain, System.Type aType)
 {
     var result = new System.Collections.Generic.List<Type>();
     var assemblies = aAppDomain.GetAssemblies();
     foreach (var assembly in assemblies)
     {
         var types = assembly.GetTypes();
         foreach (var type in types)
         {
             if (type.IsSubclassOf(aType))
                 result.Add(type);
         }
     }
     return result.ToArray();
 }
开发者ID:InvertGames,项目名称:uFrame.Editor,代码行数:15,代码来源:UFramePackageExtensions.cs

示例13: Notify

        public void Notify(params object[] args)
        {
            if (args != null && args.Length != 0 && args[0] is EntityEvent)
            {
                BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey;
                if (!(key == null))
                {
                    SO so = key.GetEntity() as SO;
                    if (PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code))
                    {
                        bool flag = PubHelper.IsUsedDMSAPI();
                        if (flag)
                        {
                            if (!string.IsNullOrEmpty(so.DescFlexField.PubDescSeg5))
                            {
                                try
                                {
                                    System.Collections.Generic.List<orderInfoDto> list = new System.Collections.Generic.List<orderInfoDto>();
                                    SI02ImplService service = new SI02ImplService();
                                    // service.Url = PubHelper.GetAddress(service.Url);
                                    //list.Add(new orderInfoDto
                                    //{
                                    //    // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7
                                    //    docStatus = "2",
                                    //    dmsSaleNo = so.DescFlexField.PubDescSeg5
                                    //});
                                    orderInfoDto orderDTO = new orderInfoDto();
                                    // 0新增,1修改,2删除,3排产
                                    orderDTO.docStatus = "2";
                                    orderDTO.dmsSaleNo = so.DescFlexField.PubDescSeg5;
                                    list.Add(orderDTO);

                                    service.Do(list.ToArray());
                                }
                                catch (System.Exception e)
                                {
                                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:HaiBoHan,项目名称:HBHDaYunsy,代码行数:44,代码来源:SODeleted.cs

示例14: LightMapTexture

        public LightMapTexture(List<Light> lights, Vector3f center, Vector3f frontVector, Vector3f rightVector, int textureSize, float realSize)
        {
            size = textureSize;
            int halfSize  = size  / 2;
            float halfRealSize = realSize / 2.0f;

            System.Collections.Generic.List<float> data = new System.Collections.Generic.List<float>();
            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    float x = halfRealSize * ((float)(halfSize - i) / (float)halfSize);
                    float y = halfRealSize * ((float)(halfSize - j) / (float)halfSize);
                    Vector3f v = frontVector * y + rightVector * x;
                    v.add(center);

                    float r, g, b;
                    r = g = b = 0.0f;
                    for (int l = 0; l < lights.Count; l++)
                    {
                        Color4f color = lights[l].calculateColor(v);
                        r += color.r;
                        g += color.g;
                        b += color.b;
                    }
                    r = r > 1.0f ? 1.0f : r;
                    g = g > 1.0f ? 1.0f : g;
                    b = b > 1.0f ? 1.0f : b;

                    data.Add(r);
                    data.Add(g);
                    data.Add(b);
                }
            }

            int[] TempGL = new int[1];

            Gl.glGenTextures(1, TempGL);
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, TempGL[0]);

            Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, 3, size, size, Gl.GL_RGB, Gl.GL_FLOAT, data.ToArray());

            textureID = TempGL[0];
        }
开发者ID:hyyly,项目名称:teslagame,代码行数:44,代码来源:LightMapTexture.cs

示例15: OnLoad

                protected override void OnLoad(EventArgs e)
                {
                        base.OnLoad(e);
                        if (this.Connection != null) {
                                System.Collections.Generic.List<string> ListaTipos = new System.Collections.Generic.List<string>();
                                ListaTipos.Add("Cualquiera|*");
                                ListaTipos.Add("Facutras|F");
                                ListaTipos.Add("Notas de débito|ND");
                                ListaTipos.Add("Notas de crédito|NC");
                                ListaTipos.Add("Facutras, notas de débito|F,ND");
                                ListaTipos.Add("Facutras, notas de crédito y débito|F,NC,ND");

                                System.Data.DataTable DocumentosTipos = this.Connection.Select("SELECT letra,nombre FROM documentos_tipos ORDER BY letra");
                                foreach (System.Data.DataRow DocumentoTipo in DocumentosTipos.Rows) {
                                        ListaTipos.Add(DocumentoTipo["nombre"].ToString() + "|" + DocumentoTipo["letra"].ToString());
                                }
                                EntradaTipoFac.SetData = ListaTipos.ToArray();
                        }
                }
开发者ID:solutema,项目名称:ultralight,代码行数:19,代码来源:Editar.cs


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