本文整理汇总了C#中Group.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Group.Clone方法的具体用法?C# Group.Clone怎么用?C# Group.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Populate
/// <summary>
/// Poblado de grupo
/// </summary>
/// <param name="pGroup"></param>
/// <param name="fileName"></param>
public void Populate(Group pGroup, string fileName)
{
RefreshData();
lblFileName.Text = fileName;
txtGroupName.Text = pGroup.Name;
_Group = pGroup.Clone<Group>();
}
示例2: ParseWhileGroup
/// <summary>
/// Parses a while loop statement.
/// </summary>
/// <param name="group">The group to parse.</param>
/// <returns>TNil on success, otherwise a TException.</returns>
TType ParseWhileGroup(Group group)
{
/* BNF for while loop:
* <while-loop> ::= 'while' <condition> ',' ( <statement> | <block> )
* The 'while' is assumed to have already been checked for
*/
if (group.Count == 1) return new TException(this, "Statement could not be evaluated",
"while loop must be given a condition");
int commaIndex = group.IndexOf(",");
if (commaIndex < 0) return new TException(this, "while loop invalid", "comma required after condition");
if (group.Count == 1)
return new TException(this,
"Statement could not be evaluated", "while loop must be given a condition");
Group conditionGroup = new Group(null);
conditionGroup.AddRange(group.GetRange(1, commaIndex - 1));
Group statementGroup = null;
TBlock block = null;
if (group.Count > commaIndex + 1) // If there is a statement after the comma, use that statement
{
statementGroup = new Group(null);
statementGroup.AddRange(group.GetRange(commaIndex + 1, group.Count - (commaIndex + 1)));
}
else // Otherwise get a block
{
TException exception;
block = new TBlock(this, out exception, false);
if (exception != null) return exception;
}
TType returnValue = TNil.Instance;
while (true)
{
// Parse the condition, and if it's true run the block or single statement, otherwise return MNil
TType value = ParseGroup((Group)conditionGroup.Clone());
if (value is TException) return value;
TBoolean result = value as TBoolean;
if (result == null)
{
bool success = false;
TVariable variable = value as TVariable;
if (variable != null)
{
result = variable.Value as TBoolean;
if (result != null) success = true;
}
if (!success)
return new TException(this, "Condition does not evaluate to a boolean value", "yes or no");
}
if (result.Value)
{
bool breakUsed = false;
if (statementGroup != null) returnValue = ParseGroup((Group)statementGroup.Clone());
else
{
bool exitFromFunction;
returnValue = block.Execute(this, out exitFromFunction, out breakUsed);
if (exitFromFunction) return returnValue;
}
if ((returnValue is TException) || breakUsed) return returnValue;
}
else return returnValue;
if (!alive) return TNil.Instance;
}
}
示例3: KioskGroup
/// <summary>
/// Initializes a new instance of the <see cref="KioskGroup" /> class.
/// </summary>
/// <param name="group">The group.</param>
public KioskGroup( Group group )
: base()
{
Group = group.Clone( false );
KioskLocations = new List<KioskLocation>();
}