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


C# IElement.get方法代码示例

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


在下文中一共展示了IElement.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Copy

        public IElement Copy(IElement element)
        {
            var targetElement = _factory.create(element.getMetaClass());

            var elementAsExt = element as IObjectAllProperties;
            if (elementAsExt == null)
            {
                throw new ArgumentException("element is not of type IObjectAllProperties");
            }

            foreach (var property in elementAsExt.getPropertiesBeingSet())
            {
                var value = element.get(property);
                targetElement.set(property, value);
            }

            return targetElement;
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:18,代码来源:ObjectCopier.cs

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