本文整理汇总了C#中IList.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# IList.CopyTo方法的具体用法?C# IList.CopyTo怎么用?C# IList.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.CopyTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SmallDocumentBlockList
/// <summary>
/// Initializes a new instance of the <see cref="SmallDocumentBlockList"/> class.
/// </summary>
/// <param name="blocks">a list of SmallDocumentBlock instances</param>
public SmallDocumentBlockList(IList blocks)
{
SmallDocumentBlock[] array = new SmallDocumentBlock[blocks.Count];
blocks.CopyTo(array, 0);
ListManagedBlock[] tmp = (ListManagedBlock[])array;
this.SetBlocks(ref tmp);
}
示例2: SignatureAnalysis
internal SignatureAnalysis(string text, int paramIndex, IList<ISignature> signatures)
{
_text = text;
_paramIndex = paramIndex;
_signatures = new ISignature[signatures.Count];
signatures.CopyTo(_signatures, 0);
Array.Sort(_signatures, (x, y) => x.Parameters.Count - y.Parameters.Count);
}
示例3: SignatureAnalysis
internal SignatureAnalysis(string text, int paramIndex, IList<ISignature> signatures, string lastKeywordArgument = null) {
_text = text;
_paramIndex = paramIndex;
_signatures = new ISignature[signatures.Count];
signatures.CopyTo(_signatures, 0);
_lastKeywordArgument = lastKeywordArgument;
Array.Sort(_signatures, (x, y) => x.Parameters.Count - y.Parameters.Count);
}
示例4: InElement
// Initialize for searching a list of values
public InElement(ExpressionElement operand, IList listElements)
{
MyOperand = operand;
ExpressionElement[] arr = new ExpressionElement[listElements.Count];
listElements.CopyTo(arr, 0);
MyArguments = new List<ExpressionElement>(arr);
this.ResolveForListSearch();
}
示例5:
private ReactiveDownloader
(IList<OneSongHeader> Songs, String UserAgent, String FolderPath, Boolean GenerateNewFilenames, String FilenameTemplate)
{
this._songs = new OneSongHeader[Songs.Count];
Songs.CopyTo(this._songs, 0);
this._userAgent = UserAgent;
this._folderPath = FolderPath;
this._generateNewFilenames = GenerateNewFilenames;
this._filenameTemplate = FilenameTemplate;
}
示例6: PersonArray
public PersonArray(IList<Person> mdos)
{
if (mdos == null || mdos.Count <= 0)
{
return;
}
Person[] ary = new Person[mdos.Count];
mdos.CopyTo(ary, 0);
setProps(ary);
}
示例7: UserArray
public UserArray(IList<User> mdo)
{
if (mdo == null || mdo.Count == 0)
{
return;
}
User[] userAry = new User[mdo.Count];
mdo.CopyTo(userAry, 0);
buildArray(userAry);
}
示例8: ListToArray
private string[] ListToArray(IList<string> stringList)
{
if (null == stringList)
{
return null;
}
string[] stringArray = new string[stringList.Count];
stringList.CopyTo(stringArray, 0);
return stringArray;
}
示例9: Contain_All_The_Same_Items
public void Contain_All_The_Same_Items(IList<int> inputData)
{
int[] initialData = new int[inputData.Count];
inputData.CopyTo(initialData, 0);
inputData.RandomShuffle();
foreach (var initialItem in initialData)
{
Assert.That(inputData, Contains.Item(initialItem));
}
}
示例10: Reduction
internal Reduction(Rule rule, IList<Token> tokens): base() {
if (rule == null) {
throw new ArgumentNullException("rule");
}
if (tokens == null) {
throw new ArgumentNullException("tokens");
}
this.rule = rule;
Token[] tokenArray = new Token[tokens.Count];
tokens.CopyTo(tokenArray, 0);
this.tokens = Array.AsReadOnly(tokenArray);
}
示例11: DataPointSelectionChangedEventArgs
public DataPointSelectionChangedEventArgs(IList<DataPoint> removedItems, IList<DataPoint> addedItems)
{
if (addedItems != null)
{
this._addedItems = new DataPoint[addedItems.Count];
addedItems.CopyTo(this._addedItems, 0);
}
if (removedItems == null)
return;
this._removedItems = new DataPoint[removedItems.Count];
removedItems.CopyTo(this._removedItems, 0);
}
示例12: FindBestConstructor
internal static bool FindBestConstructor(Type t, IList<object> parameters, out ConstructorInfo constructorInfo, out object[] convertedParameters)
{
MethodBase methodBase;
object[] parameterObjects = new object[parameters.Count];
parameters.CopyTo(parameterObjects, 0);
if (ReflectionHelper.FindBestMember(t.GetConstructors(), parameterObjects, out methodBase, out convertedParameters))
{
constructorInfo = (ConstructorInfo) methodBase;
return true;
}
constructorInfo = null;
return false;
}
示例13: GetAttributesFrom
private XmlNodeList GetAttributesFrom(XmlNode node, IList<string> arguments, bool warnIfEmpty)
{
string[] array = new string[arguments.Count];
arguments.CopyTo(array, 0);
string xpath = "@" + string.Join("|@", array);
XmlNodeList xmlNodeList = node.SelectNodes(xpath);
if (xmlNodeList.Count == 0 && warnIfEmpty && arguments.Count == 1)
this.Log.LogWarning("Argument '{0}' did not match any attributes", new object[1]
{
(object) arguments[0]
});
return xmlNodeList;
}
示例14: ThinkAsync
public async Task<int> ThinkAsync(IList<char> gameBoard)
{
// Copy the contents of the IList to a string.
char[] arrayTmp = new char[9];
gameBoard.CopyTo(arrayTmp, 0);
string board = new String(arrayTmp);
// Frequently take the center square if the board is empty.
System.Random random = new System.Random((int)System.DateTime.Now.Ticks);
if (random.Next() % 2 == 0 && gameBoard.All<char>((ch) => ch == m_emptySymbol.Symbol))
{
return 4;
}
// Approximate counts of iterations the algorithm makes for each number of available moves at the root level.
uint[] allIterations = { 0u, 2u, 5u, 15u, 50u, 200u, 930u, 7300u, 60000u, 550000u };
var moves = MiniMax.AvailableMoves(board, m_emptySymbol.Symbol);
uint totalIterations = allIterations[moves.Length - 1];
// Report every 1%.
uint nextReportIter = totalIterations / 100;
uint iterBy = nextReportIter;
// This is called on every iteration of the minimax algorithm.
MiniMax.CallBackFn callback = /*[total_iterations, &next_report_iter, iter_by, reporter]*/(int iter_count) =>
{
if (iter_count == nextReportIter)
{
double progress = 100.0 * iter_count / totalIterations;
//reporter.report(Math.Min(progress, 100.0));
nextReportIter += iterBy;
}
};
// Run the minimax algorithm in parallel if there are enough iterations.
// Otherwise, run it serially, as the overhead of parallelism may not benefit.
int iterCount = 0;
System.Tuple<int, int> t;
//if (totalIterations > 500)
//{
// t = parallel_minimax(board, m_symbol, m_opponentSymbol, m_emptySymbol, m_symbol, iterCount, callback);
//}
//else
//{
t = await MiniMax.Minimax(board, m_symbol.Symbol, m_opponentSymbol.Symbol, m_emptySymbol.Symbol, m_symbol.Symbol, iterCount, callback);
//}
// Return the index part.
return t.Item1;
}
示例15: TaggedAppointmentArray
public TaggedAppointmentArray(string tag, IList<Appointment> mdos)
{
if (mdos == null || mdos.Count == 0)
{
this.count = 0;
return;
}
Appointment[] appts = new Appointment[mdos.Count];
mdos.CopyTo(appts, 0);
initialize(tag, appts);
}