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


C# IEmitter.GetEntityName方法代码示例

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


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

示例1: GetEnumValue

        public static object GetEnumValue(IEmitter emitter, IType type, object constantValue)
        {
            var enumMode = emitter.Validator.EnumEmitMode(type);

            if ((emitter.Validator.IsIgnoreType(type.GetDefinition()) && enumMode == -1) || enumMode == 2)
            {
                return constantValue;
            }

            if (enumMode >= 3)
            {
                var member = type.GetFields().FirstOrDefault(f => f.ConstantValue == constantValue);

                if (member == null)
                {
                    return constantValue;
                }

                string enumStringName = member.Name;
                var attr = emitter.GetAttribute(member.Attributes, "Bridge.NameAttribute");

                if (attr != null)
                {
                    enumStringName = emitter.GetEntityName(member);
                }
                else
                {
                    switch (enumMode)
                    {
                        case 3:
                            enumStringName = member.Name.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + member.Name.Substring(1);
                            break;
                        case 4:
                            break;
                        case 5:
                            enumStringName = enumStringName.ToLowerInvariant();
                            break;
                        case 6:
                            enumStringName = enumStringName.ToUpperInvariant();
                            break;
                    }
                }

                return enumStringName;
            }

            return constantValue;
        }
开发者ID:txdv,项目名称:Builder,代码行数:48,代码来源:Helpers.cs

示例2: GetPropertyRef

        public static string GetPropertyRef(IMember property, IEmitter emitter, bool isSetter = false, bool noOverload = false, bool ignoreInterface = false)
        {
            var name = emitter.GetEntityName(property, true, ignoreInterface);

            if (!noOverload)
            {
                var overloads = OverloadsCollection.Create(emitter, property, isSetter);
                name = overloads.HasOverloads ? overloads.GetOverloadName() : name;
                noOverload = !overloads.HasOverloads;
            }

            if (Helpers.IsFieldProperty(property, emitter))
            {

                return noOverload ? emitter.GetEntityName(property, false) : name;
            }

            return (isSetter ? "set" : "get") + name;
        }
开发者ID:txdv,项目名称:Builder,代码行数:19,代码来源:Helpers.cs

示例3: GetEventRef

        public static string GetEventRef(IMember property, IEmitter emitter, bool remove = false, bool noOverload = false, bool ignoreInterface = false)
        {
            var name = emitter.GetEntityName(property, true, ignoreInterface);

            if (!noOverload)
                {
                var overloads = OverloadsCollection.Create(emitter, property, remove);
                name = overloads.HasOverloads ? overloads.GetOverloadName() : name;
                noOverload = !overloads.HasOverloads;
                }
            return (remove ? "remove" : "add") + name;
        }
开发者ID:txdv,项目名称:Builder,代码行数:12,代码来源:Helpers.cs

示例4: GetPropertyRef

        public static string GetPropertyRef(IMember property, IEmitter emitter, bool isSetter = false, bool noOverload = false, bool ignoreInterface = false)
        {
            if (property.DeclaringTypeDefinition != null &&
                emitter.Validator.IsIgnoreType(property.DeclaringTypeDefinition))
            {
                var attrName = emitter.GetEntityNameFromAttr(property, isSetter);

                if (!string.IsNullOrEmpty(attrName))
                {
                    return attrName;
                }
            }

            string name = emitter.GetEntityName(property, true, ignoreInterface);
            if(property.SymbolKind == SymbolKind.Indexer && name == "Item") {
                name = "";
            }
            else {
                if(!noOverload) {
                    var overloads = OverloadsCollection.Create(emitter, property, isSetter);
                    name = overloads.HasOverloads ? overloads.GetOverloadName() : name;
                    noOverload = !overloads.HasOverloads;
                }
                if(Helpers.IsFieldProperty(property, emitter)) {
                    return noOverload ? emitter.GetEntityName(property, false) : name;
                }
            }
            return (isSetter ? "set" : "get") + name;
        }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:29,代码来源:Helpers.cs


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