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


C# IList.ToArray方法代码示例

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


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

示例1: Image3D

        public Image3D(string workingDirectory, IList<Image2D> images)
        {
            this.WorkingDirectory = workingDirectory;

            this.OriginalSlices = images.ToArray();
            this.Slices = images.ToArray();
        }
开发者ID:palik,项目名称:OCTSegmentation,代码行数:7,代码来源:Image3D.cs

示例2: GetQueryResult

        public DataTable GetQueryResult(string Connection,
                            IList<string> lstPdLine, IList<string> Model, bool IsWithoutShift, string ModelCategory)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                string SQLText = "";
                StringBuilder sb = new StringBuilder();
                
                sb.AppendLine("SELECT DISTINCT a.ProductID,a.CUSTSN,b.InfoValue as 'IMGCL',c.Line ");
                sb.AppendLine("FROM Product a  (NOLOCK) ");
                sb.AppendLine("INNER JOIN ProductInfo b (NOLOCK) ON b.ProductID = a.ProductID ");
                sb.AppendLine("INNER JOIN ProductStatus c (NOLOCK) ON c.ProductID = a.ProductID ");
                sb.AppendLine("WHERE  b.InfoType='IMGCL' ");

                if (lstPdLine.Count > 0)
                {
                    if (IsWithoutShift)
                    {
                        sb.AppendFormat("AND SUBSTRING(c.Line,1,1) in ('{0}') ", string.Join("','", lstPdLine.ToArray()));
                    }
                    else
                    {
                        sb.AppendFormat("AND c.Line in ('{0}') ", string.Join("','", lstPdLine.ToArray()));
                    }
                }
                if (Model.Count > 0)
                {
                    sb.AppendFormat("AND a.ProductID in ('{0}') ", string.Join("','", Model.ToArray()));
                }
                if (ModelCategory != "")
                {
                    sb.AppendFormat(" AND dbo.CheckModelCategory(a.Model,'" + ModelCategory + "')='Y' ");
                }              
                SQLText = sb.ToString();
                return SQLHelper.ExecuteDataFill(Connection,
                                                 System.Data.CommandType.Text,
                                                 SQLText
                                                 );
            }
            catch (Exception e)
            {

                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:52,代码来源:FA_IMG_2PPQuery.cs

示例3: MultilayerPerceptron

        public MultilayerPerceptron(int numInputs, int numOutputs, IList<int> hiddenLayerSizes)
        {
            if (numInputs <= 0)
                throw new NeuralNetworkException($"Argument {nameof(numInputs)} must be positive; was {numInputs}.");

            if (numOutputs <= 0)
                throw new NeuralNetworkException($"Argument {nameof(numOutputs)} must be positive; was {numOutputs}.");

            if (hiddenLayerSizes == null || !hiddenLayerSizes.Any())
                throw new NeuralNetworkException($"Argument {nameof(hiddenLayerSizes)} cannot be null or empty.");

            if (hiddenLayerSizes.Any(h => h <= 0))
            {
                var badSize = hiddenLayerSizes.First(h => h <= 0);
                var index = hiddenLayerSizes.IndexOf(badSize);
                throw new NeuralNetworkException($"Argument {nameof(hiddenLayerSizes)} must contain only positive " +
                                                $"values; was {badSize} at index {index}.");
            }

            NumInputs = numInputs;
            NumOutputs = numOutputs;
            HiddenLayerSizes = hiddenLayerSizes.ToArray();

            Weights = new double[hiddenLayerSizes.Count + 1][];

            for (var i = 0; i < hiddenLayerSizes.Count + 1; i++)
            {
                if (i == 0)
                    Weights[i] = new double[(numInputs + 1) * hiddenLayerSizes[0]];
                else if (i < hiddenLayerSizes.Count)
                    Weights[i] = new double[(hiddenLayerSizes[i-1] + 1) * hiddenLayerSizes[i]];
                else
                    Weights[i] = new double[(hiddenLayerSizes[hiddenLayerSizes.Count - 1] + 1) * numOutputs];
            }
        }
开发者ID:ikhramts,项目名称:NNX,代码行数:35,代码来源:MultilayerPerceptron.cs

示例4: PathRecord

 public PathRecord(IVertex target, double weight, IList<IEdge> edgeTracks)
 {
     Target = target;
     Weight = weight;
     EdgeTracks = edgeTracks.ToArray();
     ParseVertexTracks(edgeTracks);
 }
开发者ID:lurongkai,项目名称:SuperNet,代码行数:7,代码来源:PathRecord.cs

示例5: FunctionCall

		public FunctionCall(Expression root, Token parenToken, IList<Expression> args, Executable owner)
			: base(root.FirstToken, owner)
		{
			this.Root = root;
			this.ParenToken = parenToken;
			this.Args = args.ToArray();
		}
开发者ID:geofrey,项目名称:crayon,代码行数:7,代码来源:FunctionCall.cs

示例6: GetPdLine

        public DataTable GetPdLine(string customer, IList<string> lstProcess, string DBConnection)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);

            try
            {
                string SQLText = @" SELECT Line,Descr FROM Line (NOLOCK) WHERE [email protected] "; // AND Stage IN (@process) ORDER BY 1";                
                SQLText += string.Format(" AND Stage IN ('{0}')", string.Join("','", lstProcess.ToArray()));
                SQLText += " ORDER BY 1";
                return SQLHelper.ExecuteDataFill(DBConnection,
                                                 System.Data.CommandType.Text,
                                                 SQLText,
                                                 SQLHelper.CreateSqlParameter("@customer", 32, customer, ParameterDirection.Input));
                                                 //SQLHelper.CreateSqlParameter("@process", 32, process, ParameterDirection.Input));
            }
            catch (Exception e)
            {

                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:27,代码来源:PdLine.cs

示例7: ImportStatement

 public ImportStatement(Token importToken, IList<Token> importChain, IList<Token> fromChain, Token asValue)
     : base(importToken)
 {
     this.ImportChain = importChain.ToArray();
     this.FromChain = fromChain == null ? null : fromChain.ToArray();
     this.AsValue = asValue;
 }
开发者ID:blakeohare,项目名称:pyweek-sentientstorage,代码行数:7,代码来源:ImportStatement.cs

示例8: ExtractConfigfileFromJar

        public static void ExtractConfigfileFromJar(string reefJar, IList<string> configFiles, string dropFolder)
        {
            var configFileNames = string.Join(" ", configFiles.ToArray());
            var startInfo = new ProcessStartInfo
            {
                FileName = GetJarBinary(),
                Arguments = @"xf " + reefJar + " " + configFileNames,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                UseShellExecute = false,
                CreateNoWindow = true
            };

            LOGGER.Log(Level.Info,
                "extracting files from jar file with \r\n" + startInfo.FileName + "\r\n" + startInfo.Arguments);
            using (var process = Process.Start(startInfo))
            {
                var outReader = process.StandardOutput;
                var errorReader = process.StandardError;
                var output = outReader.ReadToEnd();
                var error = errorReader.ReadToEnd();
                process.WaitForExit();
                if (process.ExitCode != 0)
                {
                    throw new InvalidOperationException("Failed to extract files from jar file with stdout :" + output +
                                                        "and stderr:" + error);
                }
            }
            LOGGER.Log(Level.Info, "files are extracted.");
        }
开发者ID:NurimOnsemiro,项目名称:reef,代码行数:30,代码来源:ClrClientHelper.cs

示例9: Serialize

 public void Serialize(IList<Employee> employees)
 {
     using (var stream = new FileStream(FilePath, FileMode.Truncate))
     {
         serializer.Serialize(stream, employees.ToArray());
     }
 }
开发者ID:Heavik,项目名称:EmployeeDB,代码行数:7,代码来源:XmlAdapter.cs

示例10: SignalExternalCommandLineArgs

        public bool SignalExternalCommandLineArgs(IList<string> args)
        {
            // handle command line arguments of second instance
            HandleArguments(args.ToArray());

            return true;
        }
开发者ID:ronnykarlsson,项目名称:DownmarkerWPF,代码行数:7,代码来源:App.xaml.cs

示例11: SystemFunctionInvocation

 public SystemFunctionInvocation(Token prefix, Token root, IList<Expression> args)
     : base(prefix)
 {
     this.Root = root;
     this.Name = root.Value;
     this.Args = args.ToArray();
 }
开发者ID:blakeohare,项目名称:pyweek-sentientstorage,代码行数:7,代码来源:SystemFunctionInvocation.cs

示例12: RemoveBreaksForElifedSwitch

		// The reason why I still run this function with actuallyDoThis = false is so that other platforms can still be exported to
		// and potentially crash if the implementation was somehow broken on Python (or some other future platform that doesn't have traditional switch statements).
		internal static Executable[] RemoveBreaksForElifedSwitch(bool actuallyDoThis, IList<Executable> executables)
		{
			List<Executable> newCode = new List<Executable>(executables);
			if (newCode.Count == 0) throw new Exception("A switch statement contained a case that had no code and a fallthrough.");
			if (newCode[newCode.Count - 1] is BreakStatement)
			{
				newCode.RemoveAt(newCode.Count - 1);
			}
			else if (newCode[newCode.Count - 1] is ReturnStatement)
			{
				// that's okay.
			}
			else
			{
				throw new Exception("A switch statement contained a case with a fall through.");
			}

			foreach (Executable executable in newCode)
			{
				if (executable is BreakStatement)
				{
					throw new Exception("Can't break out of case other than at the end.");
				}
			}

			return actuallyDoThis ? newCode.ToArray() : executables.ToArray();
		}
开发者ID:geofrey,项目名称:crayon,代码行数:29,代码来源:Executable.cs

示例13: CheckGoodsIssueFIFO

        public bool CheckGoodsIssueFIFO(string locationCode, string itemCode, DateTime baseManufatureDate, IList<string> huIdList)
        {
            DetachedCriteria criteria = DetachedCriteria.For<LocationLotDetail>();
            criteria.SetProjection(Projections.Count("Id"));

            criteria.CreateAlias("Hu", "hu");
            criteria.CreateAlias("Location", "loc");
            criteria.CreateAlias("Item", "item");

            criteria.Add(Expression.IsNotNull("Hu"));
            criteria.Add(Expression.Gt("Qty", new Decimal(0)));
            criteria.Add(Expression.Eq("item.Code", itemCode));
            criteria.Add(Expression.Eq("loc.Code", locationCode));
            criteria.Add(Expression.Lt("hu.ManufactureDate", baseManufatureDate));
            criteria.Add(Expression.Not(Expression.In("hu.HuId", huIdList.ToArray<string>())));

            IList<int> list = this.criteriaMgr.FindAll<int>(criteria);
            if (list[0] > 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:26,代码来源:LocationLotDetailMgr.cs

示例14: Decompress

        /// <summary>
        /// Decompresses a file.
        /// </summary>
        public static byte[] Decompress( IList<byte> bytes )
        {
            List<byte> result = new List<byte>( 1024 * 1024 );
            using( GZipStream stream = new GZipStream( new MemoryStream( bytes.ToArray() ), CompressionMode.Decompress, false ) )
            {
                byte[] buffer = new byte[2048];

                int b = 0;
                while( true )
                {
                    b = stream.Read( buffer, 0, 2048 );
                    if( b < 2048 )
                        break;
                    else
                        result.AddRange( buffer );
                }

                if( b > 0 )
                {
                    result.AddRange( buffer.Sub( 0, b - 1 ) );
                }
            }

            return result.ToArray();
        }
开发者ID:Glain,项目名称:FFTPatcher,代码行数:28,代码来源:GZip.cs

示例15: FindTwoSum

    public static Tuple<int, int> FindTwoSum(IList<int> list, int sum)
    {
        var newList = list.ToArray();
        var pairs = (from number in list where newList.Contains(sum - number) select Tuple.Create(Array.IndexOf(newList, number), Array.LastIndexOf(newList, sum - number))).ToList();

        return pairs.Count > 0 ? pairs[0] : null;
    }
开发者ID:rodrigo-morais,项目名称:test-two-sum,代码行数:7,代码来源:Program.cs


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