本文整理汇总了C#中Link.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Link.GetType方法的具体用法?C# Link.GetType怎么用?C# Link.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteLink
void WriteLink(JsonWriter writer, Link link)
{
writer.WriteStartObject();
foreach (var info in link.GetType().GetProperties())
{
switch (info.Name.ToLowerInvariant())
{
case "href":
writer.WritePropertyName("href");
writer.WriteValue(link.Href.Replace("~/", "/"));
break;
case "rel":
// do nothing ...
break;
case "istemplated":
if (link.IsTemplated)
{
writer.WritePropertyName("templated");
writer.WriteValue(true);
}
break;
default:
if ((info.PropertyType == typeof (string)))
{
var text = info.GetValue(link) as string;
if (string.IsNullOrEmpty(text))
continue; // no value set, so don't write this property ...
writer.WritePropertyName(info.Name.ToLowerInvariant());
writer.WriteValue(text);
}
// else: no sensible way to serialize ...
break;
}
}
writer.WriteEndObject();
}
示例2: SwitchLink
public void SwitchLink(Link link)
{
ClearView();
if (link == null) return;
this.rootLink = link;
this.GroupSync = false;
insView.GroupSync = false;
this.activeGroup = null;
int heightCount = 0, height = 0;
int itemCount = link.components.Count;
InspectorInfo rootItem = new InspectorInfo(null, link, sidebar);
CreateItem(new DetailedItem(manager, this, rootItem, backPanel, heightCount, LeftPadding));
height = viewItems[0].itemHeight - 2;
heightCount += height;
InspectorInfo formationItem = new InspectorInfo(null, rootItem, link.formation, link.GetType().GetProperty("formation"));
CreateItem(new DetailedItem(manager, this, formationItem, backPanel, heightCount, LeftPadding));
InspectorInfo dictItem = new InspectorInfo(null, rootItem, link.components, link.GetType().GetProperty("components"));
foreach (Type t in link.components.Keys)
{
string tooltip = "";
Info info = Utils.GetInfoClass(link.components[t]);
if (info != null)
{
if ((int)info.userLevel > (int)sidebar.userLevel) continue;
tooltip = info.summary;
}
heightCount += height;
InspectorInfo cItem = new InspectorInfo(null, dictItem, link.components[t], t);
DetailedItem di = new DetailedItem(manager, this, cItem, backPanel, heightCount, LeftPadding);
di.toolTip = tooltip;
CreateItem(di);
}
ScrollPosition = 0;
backPanel.ScrollTo(backPanel.ScrollBarValue.Horizontal, 0);
SetVisible(false);
backPanel.Refresh();
}