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


C# OutputSettings.EmitName方法代码示例

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


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

示例1: GetFieldString

		protected override string GetFieldString (IField field, OutputSettings settings)
		{
			if (field == null)
				return "";
			var result = new StringBuilder ();
			bool isEnum = field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum;
			AppendModifiers (result, settings, field);
			
			if (!settings.CompletionListFomat && settings.IncludeReturnType && !isEnum) {
				result.Append (GetTypeReferenceString (field.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			if (!settings.IncludeReturnType && settings.UseFullName) {
				result.Append (GetTypeReferenceString (field.DeclaringTypeDefinition, settings));
				result.Append (settings.Markup ("."));
			}
			result.Append (settings.EmitName (field, FilterName (Format (field.Name))));
			
			if (settings.CompletionListFomat && settings.IncludeReturnType && !isEnum) {
				result.Append (settings.Markup (" : "));
				result.Append (GetTypeReferenceString (field.ReturnType, settings));
			}
			return result.ToString ();
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:25,代码来源:CSharpAmbience.cs

示例2: GetEventString

		protected override string GetEventString (IEvent evt, OutputSettings settings)
		{
			if (evt == null)
				return "";
			var result = new StringBuilder ();
			AppendModifiers (result, settings, evt);
			if (settings.IncludeKeywords)
				result.Append (settings.EmitKeyword ("event"));
			if (!settings.CompletionListFomat && settings.IncludeReturnType) {
				result.Append (GetTypeReferenceString (evt.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			if (!settings.IncludeReturnType && settings.UseFullName) {
				result.Append (GetTypeReferenceString (evt.DeclaringTypeDefinition, new OutputSettings (OutputFlags.UseFullName)));
				result.Append (settings.Markup ("."));
			}
			
			AppendExplicitInterfaces (result, evt, settings);
			result.Append (settings.EmitName (evt, Format (FilterName (evt.Name))));
			
			if (settings.CompletionListFomat && settings.IncludeReturnType) {
				result.Append (settings.Markup (" : "));
				result.Append (GetTypeReferenceString (evt.ReturnType, settings));
			}
			return result.ToString ();
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:27,代码来源:CSharpAmbience.cs

示例3: GetDestructorString

		protected override string GetDestructorString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, settings.Markup ("~") + Format (FilterName (method.DeclaringTypeDefinition != null ? method.DeclaringTypeDefinition.Name : method.Name))), false);
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:4,代码来源:CSharpAmbience.cs

示例4: GetOperatorString

		protected override string GetOperatorString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, Format (FilterName (method.Name))), true);
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:4,代码来源:CSharpAmbience.cs

示例5: GetTypeString

		protected override string GetTypeString (IType t, OutputSettings settings)
		{
			if (t.Kind == TypeKind.Unknown) {
				return t.Name;
			}
			
			if (t.Kind == TypeKind.TypeParameter)
				return t.FullName;
			
			var typeWithElementType = t as TypeWithElementType;
			if (typeWithElementType != null) {
				var sb = new StringBuilder ();
			
				if (typeWithElementType is PointerType) {
					sb.Append (settings.Markup ("*"));
				} 
				AppendType (sb, typeWithElementType.ElementType, settings);
				
				if (typeWithElementType is ArrayType) {
					sb.Append (settings.Markup ("["));
					sb.Append (settings.Markup (new string (',', ((ArrayType)t).Dimensions - 1)));
					sb.Append (settings.Markup ("]"));
				}
				return sb.ToString ();
			}
			
			ITypeDefinition type = t.GetDefinition ();
			if (type == null)
				return "";
			
			if (!settings.UseNETTypeNames && type.Namespace == "System" && type.TypeParameterCount == 0) {
				switch (type.Name) {
				case "Object":
					return "object";
				case "Boolean":
					return "bool";
				case "Char":
					return "char";
				case "SByte":
					return "sbyte";
				case "Byte":
					return "byte";
				case "Int16":
					return "short";
				case "UInt16":
					return "ushort";
				case "Int32":
					return "int";
				case "UInt32":
					return "uint";
				case "Int64":
					return "long";
				case "UInt64":
					return "ulong";
				case "Single":
					return "float";
				case "Double":
					return "double";
				case "Decimal":
					return "decimal";
				case "String":
					return "string";
				case "Void":
					return "void";
				}
			}
			
			// output anonymous type
			if (type.IsSynthetic && type.Name == "$Anonymous$")
				return GetTypeReferenceString (type, settings);
			
			var result = new StringBuilder ();
			
			
			var def = type;
			AppendModifiers (result, settings, def);
			if (settings.IncludeKeywords)
				result.Append (GetString (def.Kind));
			if (result.Length > 0 && !result.ToString ().EndsWith (" "))
				result.Append (settings.Markup (" "));
			
			
			if (type.Kind == TypeKind.Delegate && settings.ReformatDelegates && settings.IncludeReturnType) {
				var invoke = type.GetDelegateInvokeMethod ();
				result.Append (GetTypeReferenceString (invoke.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			
			if (settings.UseFullInnerTypeName && type.DeclaringTypeDefinition != null) {
				bool includeGenerics = settings.IncludeGenerics;
				settings.OutputFlags |= OutputFlags.IncludeGenerics;
				string typeString = GetTypeReferenceString (type.DeclaringTypeDefinition, settings);
				if (!includeGenerics)
					settings.OutputFlags &= ~OutputFlags.IncludeGenerics;
				result.Append (typeString);
				result.Append (settings.Markup ("."));
			}
			result.Append (settings.EmitName (type, type.Name));
			if (settings.IncludeGenerics && type.TypeParameterCount > 0) {
//.........这里部分代码省略.........
开发者ID:txdv,项目名称:monodevelop,代码行数:101,代码来源:CSharpAmbience.cs

示例6: GetMethodString

		protected override string GetMethodString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, Format (FilterName (method.EntityType == EntityType.Constructor || method.EntityType == EntityType.Destructor ? method.DeclaringTypeDefinition.Name : method.Name))), true);
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:4,代码来源:CSharpAmbience.cs

示例7: GetConstructorString

        protected override string GetConstructorString(IMethod method, OutputSettings settings)
        {
            var result = new StringBuilder ();

            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, method);

            result.Append (settings.EmitKeyword ("Constructor"));
            result.Append (settings.EmitName (method, method.DeclaringType.Name));

            if (settings.IncludeParameters) {
                result.Append (settings.Markup ("("));
                bool first = true;
                foreach (var parameter in method.Parameters) {
                    if (!first)
                        result.Append (settings.Markup (", "));
                    result.Append (GetParameterString (method, parameter, settings));
                    first = false;
                }
                result.Append (settings.Markup (")"));
            }
            return result.ToString ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:23,代码来源:NetAmbience.cs

示例8: GetEventString

        protected override string GetEventString(IEvent evt, OutputSettings settings)
        {
            var result = new StringBuilder ();

            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, evt);

            result.Append (settings.EmitKeyword ("Event"));
            result.Append (settings.EmitName (evt, evt.Name));

            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (evt.ReturnType, settings));
            }
            return result.ToString ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:16,代码来源:NetAmbience.cs

示例9: GetPropertyString

 protected override string GetPropertyString(IProperty property, OutputSettings settings)
 {
     var result = new StringBuilder ();
     if (settings.IncludeModifiers)
         AppendModifiers (result, settings, property);
     result.Append (settings.EmitKeyword ("Property"));
     result.Append (settings.EmitName (property, property.Name));
     if (settings.IncludeReturnType) {
         result.Append (settings.Markup (" : "));
         result.Append (GetTypeReferenceString (property.ReturnType, settings));
     }
     return result.ToString ();
 }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:13,代码来源:NetAmbience.cs

示例10: GetTypeString

        protected override string GetTypeString(IType t, OutputSettings settings)
        {
            ITypeDefinition type = t.GetDefinition ();
            var result = new StringBuilder ();
            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, type);
            if (settings.IncludeKeywords)
                result.Append (settings.EmitKeyword (GetString (type.Kind)));

            result.Append (settings.EmitName (type, settings.UseFullName ? type.FullName : type.Name));

            int parameterCount = type.TypeParameters.Count;

            if (settings.IncludeGenerics && parameterCount > 0) {
                result.Append (settings.Markup ("<"));
                if (!settings.HideGenericParameterNames) {
                    for (int i = 0; i < parameterCount; i++) {
                        if (i > 0)
                            result.Append (settings.Markup (", "));
                        result.Append (type.TypeParameters [i].Name);
                    }
                }
                result.Append (settings.Markup (">"));
            }

            if (settings.IncludeBaseTypes && type.DirectBaseTypes.Any ()) {
                result.Append (settings.Markup (" : "));
                bool first = true;
                foreach (var baseType in type.DirectBaseTypes) {
                    if (baseType.Equals (type.Compilation.FindType (KnownTypeCode.Object)))
                        continue;
                    if (!first)
                        result.Append (settings.Markup (", "));
                    first = false;
                    result.Append (GetTypeReferenceString (baseType, settings));
                }

            }
            return result.ToString ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:40,代码来源:NetAmbience.cs

示例11: GetOperatorString

        protected override string GetOperatorString(IMethod method, OutputSettings settings)
        {
            var result = new StringBuilder ();

            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, method);

            result.Append (settings.EmitKeyword ("Operator"));
            result.Append (settings.EmitName (method, settings.UseFullName ? method.FullName : method.Name));

            if (settings.IncludeParameters) {
                result.Append (settings.Markup ("("));
                bool first = true;
                foreach (var parameter in method.Parameters) {
                    if (!first)
                        result.Append (settings.Markup (", "));
                    result.Append (GetParameterString (method, parameter, settings));
                    first = false;
                }
                result.Append (settings.Markup (")"));
            }

            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (method.ReturnType, settings));
            }
            return result.ToString ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:28,代码来源:NetAmbience.cs

示例12: GetIndexerString

        protected override string GetIndexerString(IProperty property, OutputSettings settings)
        {
            var result = new StringBuilder ();
            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, property);
            result.Append (settings.EmitKeyword ("Indexer"));
            result.Append (settings.EmitName (property, property.Name));

            if (settings.IncludeParameters && property.Parameters.Count > 0) {
                result.Append (settings.Markup ("("));
                bool first = true;
                foreach (var parameter in property.Parameters) {
                    if (!first)
                        result.Append (settings.Markup (", "));
                    result.Append (GetParameterString (property, parameter, settings));
                    first = false;
                }
                result.Append (settings.Markup (")"));
            }
            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (property.ReturnType, settings));
            }
            return result.ToString ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:25,代码来源:NetAmbience.cs

示例13: GetFieldString

        protected override string GetFieldString(IField field, OutputSettings settings)
        {
            var result = new StringBuilder ();

            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, field);

            result.Append (settings.EmitKeyword ("Field"));
            result.Append (settings.EmitName (field, field.Name));

            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (field.ReturnType, settings));
            }
            return result.ToString ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:16,代码来源:NetAmbience.cs

示例14: GetIndexerString

		protected override string GetIndexerString (IProperty property, OutputSettings settings)
		{
			if (property == null)
				return "";
			var result = new StringBuilder ();
			
			AppendModifiers (result, settings, property);
			
			if (settings.IncludeReturnType) {
				result.Append (GetTypeReferenceString (property.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			if (!settings.IncludeReturnType && settings.UseFullName) {
				result.Append (GetTypeReferenceString (property.DeclaringTypeDefinition, new OutputSettings (OutputFlags.UseFullName)));
				result.Append (settings.Markup ("."));
			}
			
			AppendExplicitInterfaces (result, property, settings);
			
			result.Append (settings.EmitName (property, Format ("this")));
			
			if (settings.IncludeParameters && property.Getter.Parameters.Count > 0) {
				result.Append (settings.Markup ("["));
				AppendParameterList (result, settings, property.Getter.Parameters);
				result.Append (settings.Markup ("]"));
			}
			if (settings.IncludeAccessor) {
				result.Append (settings.Markup (" {"));
				if (property.CanGet)
					result.Append (settings.Markup (" get;"));
				if (property.CanSet)
					result.Append (settings.Markup (" set;"));
				result.Append (settings.Markup (" }"));
			}
			return result.ToString ();
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:37,代码来源:CSharpAmbience.cs

示例15: GetPropertyString

        protected override string GetPropertyString(ICSharpCode.NRefactory.TypeSystem.IProperty property, OutputSettings settings)
        {
            if (property == null)
                return "";
            var result = new StringBuilder ();
            AppendModifiers (result, settings, property);
            if (!settings.CompletionListFomat && settings.IncludeReturnType) {
                result.Append (GetTypeReferenceString (property.ReturnType, settings));
                result.Append (settings.Markup (" "));
            }

            if (!settings.IncludeReturnType && settings.UseFullName) {
                result.Append (GetTypeReferenceString (property.DeclaringTypeDefinition, new OutputSettings (OutputFlags.UseFullName)));
                result.Append (settings.Markup ("."));
            }

            // TypeScript does not support explicit interface implementation.
            //AppendExplicitInterfaces (result, property, settings);

            if (property.EntityType == EntityType.Indexer) {
                result.Append (settings.EmitName (property, "this"));
            } else {
                result.Append (settings.EmitName (property, Format (FilterName (property.Name))));
            }

            if (settings.IncludeParameters && property.Parameters.Count > 0) {
                result.Append (settings.Markup ("["));
                AppendParameterList (result, settings, property.Parameters);
                result.Append (settings.Markup ("]"));
            }

            if (settings.CompletionListFomat && settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (property.ReturnType, settings));
            }

            if (settings.IncludeAccessor) {
                result.Append (settings.Markup (" {"));
                if (property.CanGet)
                    result.Append (settings.Markup (" get;"));
                if (property.CanSet)
                    result.Append (settings.Markup (" set;"));
                result.Append (settings.Markup (" }"));
            }

            return result.ToString ();
        }
开发者ID:atsushieno,项目名称:md-typescript,代码行数:47,代码来源:TypeScriptAmbience.cs


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