本文整理汇总了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();
}
示例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);
}
}
示例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];
}
}
示例4: PathRecord
public PathRecord(IVertex target, double weight, IList<IEdge> edgeTracks)
{
Target = target;
Weight = weight;
EdgeTracks = edgeTracks.ToArray();
ParseVertexTracks(edgeTracks);
}
示例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();
}
示例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);
}
}
示例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;
}
示例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.");
}
示例9: Serialize
public void Serialize(IList<Employee> employees)
{
using (var stream = new FileStream(FilePath, FileMode.Truncate))
{
serializer.Serialize(stream, employees.ToArray());
}
}
示例10: SignalExternalCommandLineArgs
public bool SignalExternalCommandLineArgs(IList<string> args)
{
// handle command line arguments of second instance
HandleArguments(args.ToArray());
return true;
}
示例11: SystemFunctionInvocation
public SystemFunctionInvocation(Token prefix, Token root, IList<Expression> args)
: base(prefix)
{
this.Root = root;
this.Name = root.Value;
this.Args = args.ToArray();
}
示例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();
}
示例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;
}
}
示例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();
}
示例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;
}