本文整理汇总了C#中ReadValueIdCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ReadValueIdCollection.Clear方法的具体用法?C# ReadValueIdCollection.Clear怎么用?C# ReadValueIdCollection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadValueIdCollection
的用法示例。
在下文中一共展示了ReadValueIdCollection.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoReadDataEncodingTest
/// <summary>
/// Reads an verifies all of the nodes.
/// </summary>
private bool DoReadDataEncodingTest()
{
// follow tree from each starting node.
bool success = true;
double increment = MaxProgress/AvailableNodes.Count;
double position = 0;
Log("Starting ReadDataEncodingTest for {0} Nodes", AvailableNodes.Values.Count);
ReadValueIdCollection nodesToRead = new ReadValueIdCollection();
int nodes = 0;
int operations = 0;
uint[] attributeIds = Attributes.GetIdentifiers();
foreach (Node node in AvailableNodes.Values)
{
nodes++;
AddDataEncodings(node, nodesToRead, attributeIds);
// process batch.
if (nodesToRead.Count > BlockSize)
{
operations += nodesToRead.Count;
if (!Read(nodesToRead))
{
success = false;
break;
}
if (nodes > AvailableNodes.Count/5)
{
Log("Read {0} attribute values for {1} nodes.", operations, nodes);
nodes = 0;
operations = 0;
}
nodesToRead.Clear();
}
position += increment;
ReportProgress(position);
}
// process final batch.
if (success)
{
if (nodesToRead.Count > 0)
{
operations += nodesToRead.Count;
if (!Read(nodesToRead))
{
success = false;
}
else
{
Log("Read {0} attribute values for {1} nodes.", operations, nodes);
}
}
}
return success;
}