本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}