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


C# IElement.isSet方法代码示例

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


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

示例1: GetPropertiesOfClassifier

        /// <summary>
        /// Returns a list of all properties within the classifier. 
        /// Also properties from generalized classes need to be returned
        /// </summary>
        /// <param name="classifier"></param>
        /// <param name="legacy">true, if legacy access to the attributes shall be used. 
        /// This means that the methods are accessed via string definitions and not via the properties</param>
        /// <returns></returns>
        public IEnumerable<string> GetPropertiesOfClassifier(IElement classifier)
        {
            if (classifier == null) throw new ArgumentNullException(nameof(classifier));

            var metaLayer = Legacy ? null : _dataLayerLogic.GetMetaLayerFor(_dataLayerLogic.GetDataLayerOfObject(classifier));
            var uml = Legacy ? null : _dataLayerLogic.Get<_UML>(metaLayer);
            var propertyOwnedAttribute = Legacy ? "ownedAttribute" : _UML._StructuredClassifiers._StructuredClassifier.ownedAttribute;
            var propertyGeneralization = Legacy ? "generalization" : _UML._Classification._Classifier.generalization;
            var propertyGeneral = Legacy ? "general" : _UML._Classification._Generalization.general;

            if (classifier.isSet(propertyOwnedAttribute))
            {
                var result = classifier.get(propertyOwnedAttribute) as IEnumerable;
                foreach (var item in result)
                {
                    yield return item.ToString();
                }
            }

            // Check for generalizations
            if (classifier.isSet(propertyGeneralization))
            {
                var generalizations = classifier.get(propertyGeneralization) as IEnumerable;
                foreach (var generalization in generalizations.Cast<IElement>())
                {
                    var general = generalization.get(propertyGeneral) as IElement;

                    // Especially for the MOF extent, the generalizations are references in xml and are
                    // filled out by the simple loader
                    if (general != null)
                    {
                        foreach (var found in GetPropertiesOfClassifier(general))
                        {
                            yield return found;
                        }
                    }
                }
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:47,代码来源:ClassifierMethods.cs

示例2: GetValue

 public static object GetValue(IElement element, string property, object defaultValue = null)
 {
     return element.isSet(property) ?
         element.get(property) :
         defaultValue;
 }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:6,代码来源:DetailFormHelper.cs


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