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


C# Element.GetType方法代码示例

本文整理汇总了C#中Element.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Element.GetType方法的具体用法?C# Element.GetType怎么用?C# Element.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Element的用法示例。


在下文中一共展示了Element.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ElementDescription

        /// <summary>
        /// Return a string describing the given element:
        /// .NET type name,
        /// category name,
        /// family and symbol name for a family instance,
        /// element id and element name.
        /// </summary>
        public static string ElementDescription( Element e )
        {
            if( null == e )
              {
            return "<null>";
              }

              // For a wall, the element name equals the
              // wall type name, which is equivalent to the
              // family name ...

              FamilyInstance fi = e as FamilyInstance;

              string typeName = e.GetType().Name;

              string categoryName = ( null == e.Category )
            ? string.Empty
            : e.Category.Name + " ";

              string familyName = ( null == fi )
            ? string.Empty
            : fi.Symbol.Family.Name + " ";

              string symbolName = ( null == fi
            || e.Name.Equals( fi.Symbol.Name ) )
              ? string.Empty
              : fi.Symbol.Name + " ";

              return string.Format( "{0} {1}{2}{3}<{4} {5}>",
            typeName, categoryName, familyName, symbolName,
            e.Id.IntegerValue, e.Name );
        }
开发者ID:jeremytammik,项目名称:EstoreFile,代码行数:39,代码来源:Util.cs

示例2: Create

        public IElementRenderer Create(Element element)
        {
            if (element is Document)
            {
                return renderFactory.CreateDocumentRender((Document)element);
            }

            if (element is Paragraph)
            {
                return renderFactory.CreateParagraphRender((Paragraph) element);
            }

            if (element is TextElement)
            {
                return renderFactory.CreateTextElementRender((TextElement)element);
            }

            if (element is Hyperlink)
            {
                return renderFactory.CreateHyperlinkRender((Hyperlink)element);
            }

            if (element is Image)
            {
                return renderFactory.CreateImageRender((Image)element);
            }

            if (element is Heading)
            {
                return renderFactory.CreateHeadingRender((Heading)element);
            }

            throw new NotSupportedException("The element -" + element.GetType().Name + " is not supported");
        }
开发者ID:alex687,项目名称:SoftUni-Homeworks,代码行数:34,代码来源:RendererFactory.cs

示例3: GetProperties

 private static string[] GetProperties(Element element)
 {
     var type = element.GetType();
     return type.GetProperties()
         .Where(x => !Element.ExcludedProperties.Contains(x.Name))
         .Select(x => x.Name)
         .OrderBy(x => x)
         .ToArray();
 }
开发者ID:MichaelBergerman,项目名称:TestR,代码行数:9,代码来源:ElementAction.cs

示例4: LowerThanOrEqual

 // Is 'a' better information than 'b'?
 //
 public bool LowerThanOrEqual(Element a, Element b) {
   if (a.GetType() != b.GetType()) {
     throw new System.InvalidOperationException(
       "operands to <= must be of same Element type"
       );
   }
   if (IsBottom(a)) { return true; }
   if (IsTop(b)) { return true; }
   if (IsTop(a)) { return false; }
   if (IsBottom(b)) { return false; }
   return AtMost(a, b);
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:14,代码来源:EGraph.cs

示例5: Join

 public Element Join(Element a, Element b) {
   if (a.GetType() != b.GetType()) {
     throw new System.InvalidOperationException(
       "operands to Join must be of same Lattice.Element type"
       );
   }
   if (IsTop(a)) { return a; }
   if (IsTop(b)) { return b; }
   if (IsBottom(a)) { return b; }
   if (IsBottom(b)) { return a; }
   return NontrivialJoin(a, b);
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:12,代码来源:EGraph.cs

示例6: BuiltInParamsCheckerFormListView

        public BuiltInParamsCheckerFormListView(Element element,
            string description,
            SortableBindingList<ParameterData> data)
        {
            _data = data;
              InitializeComponent();
              Text = description + " " + Text;

              _listViewItemSorter = new ListViewItemSorter();
              lvParameters.ListViewItemSorter = _listViewItemSorter;

            tslElementType.Text = element.GetType().ToString();
        }
开发者ID:jeremytammik,项目名称:BipChecker,代码行数:13,代码来源:BuiltInParamsCheckerFormListView.cs

示例7: Create

        internal static IWPFRenderer Create(Element element)
        {
            if (!Forms.IsInitialized)
                throw new InvalidOperationException("Xamarin.Forms not initialized");

            if (element == null)
                throw new NotImplementedException();

            var renderer = Registrar.Registered.GetHandler<IWPFRenderer>(element.GetType());
            if (renderer != null)
                renderer.Model = element;
            return renderer;
        }
开发者ID:Moeinmontazeripour,项目名称:xamarin-forms-wpf,代码行数:13,代码来源:RendererFactory.cs

示例8: UndoPoint

		public UndoPoint(Element element, UndoAction action)
		{
			if (! (element is Shape || element is Line)) throw new UndoPointException("Element must be of type Shape or type Line.");
			
			mKey = element.Key;
			mBytes = SerializeElement(element);
			mAction = action;
			mObjectType = element.GetType();
			if (element is Shape) mUndoType = UndoType.Shape;
			if (element is Line) mUndoType = UndoType.Line;

			mContainer = element.Container;
			mLayer = element.Layer;
		}
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:14,代码来源:UndoPoint.cs

示例9: ElementDescription

        /// <summary>
        /// Return a description string for a given element.
        /// </summary>
        public static string ElementDescription( Element e )
        {
            string description = ( null == e.Category )
            ? e.GetType().Name
            : e.Category.Name;

              FamilyInstance fi = e as FamilyInstance;

              if( null != fi )
              {
            description += " '" + fi.Symbol.Family.Name + "'";
              }

              if( null != e.Name )
              {
            description += " '" + e.Name + "'";
              }
              return description;
        }
开发者ID:jeremytammik,项目名称:AdnRevitApiLabsXtra,代码行数:22,代码来源:LabUtils.cs

示例10: WalkElement

        // Because the Element's won't be nested too deep (max 100), a Stack based
        // iterative approach is not necessary so recursion is used for clarity.
        private static IEnumerable<Element> WalkElement(Element element)
        {
            ICustomElement customElement = element as ICustomElement;
            if ((customElement == null) || customElement.ProcessChildren)
            {
                yield return element; // Is a valid Element

                // Explore the children
                foreach (var child in element.Children)
                {
                    foreach (var e in WalkElement(child))
                    {
                        yield return e;
                    }
                }

                // Explore the properties
                TypeBrowser browser = TypeBrowser.Create(element.GetType());
                foreach (var property in browser.Elements)
                {
                    // All properties with their ElementName set to null will be Elements
                    // Check here to avoid the GetValue the property is not an Element.
                    if (property.Item2.ElementName == null)
                    {
                        object value = property.Item1.GetValue(element, null);
                        if (value != null)
                        {
                            foreach (var e in WalkElement((Element)value))
                            {
                                yield return e;
                            }
                        }
                    }
                }
            }
        }
开发者ID:LiveEarthSoftware,项目名称:sharpkml,代码行数:38,代码来源:ElementWalker.cs

示例11: AllowElement

            /// <summary>
            /// Allow an element of the specified System.Type to be selected.
            /// </summary>
            /// <param name="element">A candidate element in selection operation.</param>
            /// <returns>Return true for specified System.Type, false for all other elements.</returns>
            public bool AllowElement( Element e )
            {
                //return null != e.Category
                // && e.Category.Id.IntegerValue == ( int ) _bic;

                return e.GetType().Equals( _type );
            }
开发者ID:jeremytammik,项目名称:AdnRevitApiLabsXtra,代码行数:12,代码来源:LabUtils.cs

示例12: saveElement

 private static void saveElement(XmlScribe scribe, Element element)
 {
     if (element.GetType() == typeof(Room))
       {
     scribe.StartElement("room");
     scribe.Attribute("id", element.ID);
     ((Room) element).Save(scribe);
     scribe.EndElement();
       }
       else if (element.GetType() == typeof(Connection))
       {
     scribe.StartElement("line");
     scribe.Attribute("id", element.ID);
     ((Connection) element).Save(scribe);
     scribe.EndElement();
       }
 }
开发者ID:PokerGigolo,项目名称:trizbort,代码行数:17,代码来源:Project.cs

示例13: WriteElements

        private void WriteElements(Element element)
        {
            TypeBrowser browser = TypeBrowser.Create(element.GetType());

            foreach (var property in browser.Elements)
            {
                object value = property.Item1.GetValue(element, null);
                if (value != null) // Make sure it needs saving
                {
                    if (property.Item2.ElementName == null) // This is an element
                    {
                        this.SerializeElement((Element)value);
                    }
                    else
                    {
                        _writer.WriteStartElement(property.Item2.ElementName, property.Item2.Namespace);
                        this.WriteData(GetString(value));
                        _writer.WriteEndElement();
                    }
                }
            }
        }
开发者ID:shocky,项目名称:MissionPlanner,代码行数:22,代码来源:Serializer.cs

示例14: SerializeElement

        private void SerializeElement(Element element)
        {
            // Write start tag
            XmlComponent component = KmlFactory.FindType(element.GetType());
            ICustomElement customElement = element as ICustomElement;
            if (customElement != null) // Takes priority over component
            {
                customElement.CreateStartElement(_writer);
                if (!customElement.ProcessChildren)
                {
                    return; // Don't need to to any more work.
                }
            }
            else if (component != null)
            {
                _writer.WriteStartElement(component.Name, component.NamespaceUri);
            }
            else // We can't handle it so ignore it
            {
                System.Diagnostics.Debug.WriteLine("Unknown Element type - please register first." + element.GetType());
                return; // Skip
            }

            // Write the attributes - unknown, serialized then namespaces.
            foreach (var att in element.Attributes)
            {
                _writer.WriteAttributeString(att.Prefix, att.Name, att.NamespaceUri, att.Value);
            }

            this.WriteAttributes(element);

            foreach (var ns in element.Namespaces.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml))
            {
                _writer.WriteAttributeString("xmlns", ns.Key, string.Empty, ns.Value);
            }

            // Now the text part
            this.WriteData(element.InnerText);

            // Now write the elements - serialized, children then unknown children.
            this.WriteElements(element);
            this.SerializeElements(element.OrderedChildren);
            this.SerializeElements(element.Orphans);

            // Finished...
            _writer.WriteEndElement();
        }
开发者ID:shocky,项目名称:MissionPlanner,代码行数:47,代码来源:Serializer.cs

示例15: ClientConnectionOnOnStreamError

 private void ClientConnectionOnOnStreamError(object sender, Element element)
 {
     Console.WriteLine("XMPP Stream Error of type {0}. ", element.GetType());
     Console.WriteLine(element.ToString());
 }
开发者ID:SimplyChris,项目名称:LibHipChat,代码行数:5,代码来源:XMPPConnectionTestsEvents.cs


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