当前位置: 首页>>代码示例>>C#>>正文


C# Link.GetType方法代码示例

本文整理汇总了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();
        }
开发者ID:iremezoff,项目名称:AspNet.Hal,代码行数:40,代码来源:LinksConverter.cs

示例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();
 }
开发者ID:GameMakersUnion,项目名称:BoulderDash-OrbIt,代码行数:37,代码来源:ComponentView.cs


注:本文中的Link.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。