本文整理汇总了C#中ICodeElement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ICodeElement.GetType方法的具体用法?C# ICodeElement.GetType怎么用?C# ICodeElement.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICodeElement
的用法示例。
在下文中一共展示了ICodeElement.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArrangeElement
/// <summary>
/// Arranges an element, delegating the responsibility to the first arranger
/// encountered who can process the request.
/// </summary>
/// <param name="parentElement">Parent code element.</param>
/// <param name="codeElement">Code element to arrange.</param>
public void ArrangeElement(ICodeElement parentElement, ICodeElement codeElement)
{
bool arranged = false;
// Region elements are ignored. Only process their children.
RegionElement regionElement = codeElement as RegionElement;
if (regionElement != null)
{
List<ICodeElement> regionChildren = new List<ICodeElement>(regionElement.Children);
regionElement.ClearChildren();
foreach (ICodeElement regionChildElement in regionChildren)
{
ArrangeElement(parentElement, regionChildElement);
}
}
else
{
foreach (IElementArranger arranger in _arrangers)
{
if (arranger.CanArrange(parentElement, codeElement))
{
arranger.ArrangeElement(parentElement, codeElement);
arranged = true;
break;
}
}
if (!arranged)
{
if (parentElement != null)
{
parentElement.AddChild(codeElement);
}
else
{
throw new InvalidOperationException(
string.Format(
Thread.CurrentThread.CurrentCulture,
"Cannot arrange element of type {0} with name '{1}'.",
codeElement.GetType().Name,
codeElement.Name));
}
}
}
}