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


C# IType.GetDelegateInvokeMethod方法代码示例

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


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

示例1: DelegateDataProvider

		public DelegateDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType) : base (ext, startOffset)
		{
			compilation = ext.UnresolvedFileCompilation;
			file = ext.CSharpUnresolvedFile;
			//			this.delegateType = delegateType;
			this.delegateMethod = delegateType.GetDelegateInvokeMethod ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:DelegateDataProvider.cs

示例2: DelegateDataProvider

		public DelegateDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType)
		{
			this.startOffset = startOffset;
//			this.ext = ext;
			this.delegateType = delegateType;
			this.delegateMethod = delegateType.GetDelegateInvokeMethod ();
		}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:7,代码来源:DelegateDataProvider.cs

示例3: AddDelegateHandlers

		string AddDelegateHandlers(CompletionDataWrapper completionList, IType delegateType, bool addSemicolon = true, bool addDefault = true, string optDelegateName = null)
		{
			IMethod delegateMethod = delegateType.GetDelegateInvokeMethod();
			PossibleDelegates.Add(delegateMethod);
			var thisLineIndent = GetLineIndent(location.Line);
			string delegateEndString = EolMarker + thisLineIndent + "}" + (addSemicolon ? ";" : "");
			//bool containsDelegateData = completionList.Result.Any(d => d.DisplayText.StartsWith("delegate("));
			if (addDefault && !completionList.AnonymousDelegateAdded) {
				completionList.AnonymousDelegateAdded = true;
				var oldDelegate = completionList.Result.FirstOrDefault(cd => cd.DisplayText == "delegate");
				if (oldDelegate != null)
					completionList.Result.Remove(oldDelegate);
				completionList.AddCustom(
					"delegate",
					"Creates anonymous delegate.",
					"delegate {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
				);
				if (LanguageVersion.Major >= 5) {
					completionList.AddCustom(
						"async delegate",
						"Creates anonymous async delegate.",
						"async delegate {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
					);
				}
			}
			var sb = new StringBuilder("(");
			var sbWithoutTypes = new StringBuilder("(");
			var state = GetState();
			var builder = new TypeSystemAstBuilder(state);

			for (int k = 0; k < delegateMethod.Parameters.Count; k++) {

				if (k > 0) {
					sb.Append(", ");
					sbWithoutTypes.Append(", ");
				}
				var convertedParameter = builder.ConvertParameter(delegateMethod.Parameters [k]);
				if (convertedParameter.ParameterModifier == ParameterModifier.Params)
					convertedParameter.ParameterModifier = ParameterModifier.None;
				sb.Append(convertedParameter.ToString(FormattingPolicy));
				sbWithoutTypes.Append(delegateMethod.Parameters [k].Name);
			}

			sb.Append(")");
			sbWithoutTypes.Append(")");
			var signature = sb.ToString();
			if (!completionList.HasAnonymousDelegateAdded(signature)) {
				completionList.AddAnonymousDelegateAdded(signature);

				completionList.AddCustom(
					"delegate" + signature,
					"Creates anonymous delegate.",
					"delegate" + signature + " {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
				);
				if (LanguageVersion.Major >= 5) {
					completionList.AddCustom(
						"async delegate" + signature,
						"Creates anonymous async delegate.",
						"async delegate" + signature + " {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
					);
				}
				if (!completionList.Result.Any(data => data.DisplayText == sb.ToString())) {
					completionList.AddCustom(
						signature,
						"Creates typed lambda expression.",
						signature + " => |" + (addSemicolon ? ";" : "")
					);
					if (LanguageVersion.Major >= 5) {
						completionList.AddCustom(
							"async " + signature,
							"Creates typed async lambda expression.",
							"async " + signature + " => |" + (addSemicolon ? ";" : "")
						);
					}

					if (!delegateMethod.Parameters.Any(p => p.IsOut || p.IsRef) && !completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) {
						completionList.AddCustom(
							sbWithoutTypes.ToString(),
							"Creates lambda expression.",
							sbWithoutTypes + " => |" + (addSemicolon ? ";" : "")
						);
						if (LanguageVersion.Major >= 5) {
							completionList.AddCustom(
								"async " + sbWithoutTypes,
								"Creates async lambda expression.",
								"async " + sbWithoutTypes + " => |" + (addSemicolon ? ";" : "")
							);
						}
					}
				}

			}

			string varName = "Handle" + delegateType.Name + optDelegateName;
			completionList.Add(factory.CreateEventCreationCompletionData(varName, delegateType, null, signature, currentMember, currentType));


			/*			 TODO:Make factory method out of it.
			// It's  needed to temporarly disable inserting auto matching bracket because the anonymous delegates are selectable with '('
			// otherwise we would end up with () => )
//.........这里部分代码省略.........
开发者ID:pentp,项目名称:SharpDevelop,代码行数:101,代码来源:CSharpCompletionEngine.cs

示例4: MatchDelegate

		bool MatchDelegate(IType delegateType, IMethod method)
		{
			if (method.SymbolKind != SymbolKind.Method)
				return false;
			var delegateMethod = delegateType.GetDelegateInvokeMethod();
			if (delegateMethod == null || delegateMethod.Parameters.Count != method.Parameters.Count) {
				return false;
			}

			for (int i = 0; i < delegateMethod.Parameters.Count; i++) {
				if (!delegateMethod.Parameters [i].Type.Equals(method.Parameters [i].Type)) {
					return false;
				}
			}
			return true;
		}
开发者ID:pentp,项目名称:SharpDevelop,代码行数:16,代码来源:CSharpCompletionEngine.cs

示例5: AddDelegateHandlers

		string AddDelegateHandlers(CompletionDataWrapper completionList, IType delegateType, bool addSemicolon = true, bool addDefault = true)
		{
			IMethod delegateMethod = delegateType.GetDelegateInvokeMethod();
			var thisLineIndent = GetLineIndent(location.Line);
			string delegateEndString = EolMarker + thisLineIndent + "}" + (addSemicolon ? ";" : "");
			//bool containsDelegateData = completionList.Result.Any(d => d.DisplayText.StartsWith("delegate("));
			if (addDefault) {
				var oldDelegate = completionList.Result.FirstOrDefault(cd => cd.DisplayText == "delegate");
				if (oldDelegate != null)
					completionList.Result.Remove(oldDelegate);
				completionList.AddCustom(
					"delegate",
					"Creates anonymous delegate.",
					"delegate {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
				);
			}
			var sb = new StringBuilder("(");
			var sbWithoutTypes = new StringBuilder("(");
			for (int k = 0; k < delegateMethod.Parameters.Count; k++) {
				if (k > 0) {
					sb.Append(", ");
					sbWithoutTypes.Append(", ");
				}
				var parameterType = delegateMethod.Parameters [k].Type;
				sb.Append(GetShortType(parameterType, GetState()));
				sb.Append(" ");
				sb.Append(delegateMethod.Parameters [k].Name);
				sbWithoutTypes.Append(delegateMethod.Parameters [k].Name);
			}
			sb.Append(")");
			sbWithoutTypes.Append(")");
			completionList.AddCustom(
				"delegate" + sb,
				"Creates anonymous delegate.",
				"delegate" + sb + " {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
			);
			if (!completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) {
				completionList.AddCustom(
					sbWithoutTypes.ToString(),
					"Creates lambda expression.",
					sbWithoutTypes + " => |" + (addSemicolon ? ";" : "")
				);
			}
			/* TODO:Make factory method out of it.
			// It's  needed to temporarly disable inserting auto matching bracket because the anonymous delegates are selectable with '('
			// otherwise we would end up with () => )
			if (!containsDelegateData) {
				var savedValue = MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket;
				MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket = false;
				completionList.Result.CompletionListClosed += delegate {
					MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket = savedValue;
				};
			}*/
			return sb.ToString();
		}
开发者ID:DavidS,项目名称:monodevelop,代码行数:55,代码来源:CSharpCompletionEngine.cs

示例6: MatchDelegate

		bool MatchDelegate(IType delegateType, IUnresolvedMethod method)
		{
			var delegateMethod = delegateType.GetDelegateInvokeMethod();
			if (delegateMethod == null || delegateMethod.Parameters.Count != method.Parameters.Count) {
				return false;
			}
			
			for (int i = 0; i < delegateMethod.Parameters.Count; i++) {
				if (!delegateMethod.Parameters [i].Type.Equals(method.Parameters [i].Type.Resolve(ctx))) {
					return false;
				}
			}
			return true;
		}
开发者ID:DavidS,项目名称:monodevelop,代码行数:14,代码来源:CSharpCompletionEngine.cs

示例7: CreateMethodDataProvider

		IParameterDataProvider IParameterCompletionDataFactory.CreateDelegateDataProvider(int startOffset, IType type)
		{
			return CreateMethodDataProvider(startOffset, new[] { type.GetDelegateInvokeMethod() });
		}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:4,代码来源:CSharpCompletionDataFactory.cs

示例8: GetDelegateOrExpressionTreeSignature

 static IMethod GetDelegateOrExpressionTreeSignature(IType t)
 {
     ParameterizedType pt = t as ParameterizedType;
     if (pt != null && pt.TypeParameterCount == 1 && pt.Name == "Expression"
         && pt.Namespace == "System.Linq.Expressions")
     {
         t = pt.GetTypeArgument(0);
     }
     return t.GetDelegateInvokeMethod();
 }
开发者ID:svermeulen,项目名称:NRefactory,代码行数:10,代码来源:TypeInference.cs

示例9: GetDelegateMarkup

		string GetDelegateMarkup (IType delegateType)
		{
			var result = new StringBuilder ();
			
			var method = delegateType.GetDelegateInvokeMethod ();

			if (delegateType.GetDefinition () != null)
				AppendModifiers (result, delegateType.GetDefinition ());
			result.Append (Highlight ("delegate ", colorStyle.KeywordDeclaration));
			result.Append (GetTypeReferenceString (method.ReturnType));
			if (BreakLineAfterReturnType) {
				result.AppendLine ();
			} else {
				result.Append (" ");
			}
			
			
			result.Append (CSharpAmbience.FilterName (delegateType.Name));

			if (delegateType.TypeArguments.Count > 0) {
				AppendTypeArgumentList (result, delegateType);
			} else {
				AppendTypeParameterList (result, delegateType.GetDefinition ());
			}

			if (formattingOptions.SpaceBeforeMethodDeclarationParameterComma)
				result.Append (" ");
			
			result.Append ('(');
			AppendParameterList (result,  method.Parameters, formattingOptions.SpaceBeforeDelegateDeclarationParameterComma, formattingOptions.SpaceAfterDelegateDeclarationParameterComma);
			result.Append (')');
			return result.ToString ();
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:33,代码来源:SignatureMarkupCreator.cs

示例10: CreateDelegateDataProvider

 public IParameterDataProvider CreateDelegateDataProvider(int startOffset, IType type) {
   var delegates = FilterMethodsForAccessibility(type, new[] { type.GetDelegateInvokeMethod() });
   return CreateMethodDataProvider(startOffset, delegates);
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:4,代码来源:CSharpCodeCompletionDataFactory.cs

示例11: ToTypeScriptName

        public static string ToTypeScriptName(IType type, IEmitter emitter, bool asDefinition = false, bool excludens = false, bool ignoreDependency = false)
        {
            if (type.Kind == TypeKind.Delegate)
            {
                var method = type.GetDelegateInvokeMethod();

                StringBuilder sb = new StringBuilder();
                sb.Append("{");
                sb.Append("(");

                var last = method.Parameters.LastOrDefault();
                foreach (var p in method.Parameters)
                {
                    var ptype = BridgeTypes.ToTypeScriptName(p.Type, emitter);

                    if (p.IsOut || p.IsRef)
                    {
                        ptype = "{v: " + ptype + "}";
                    }

                    sb.Append(p.Name + ": " + ptype);
                    if (p != last)
                    {
                        sb.Append(", ");
                    }
                }

                sb.Append(")");
                sb.Append(": ");
                sb.Append(BridgeTypes.ToTypeScriptName(method.ReturnType, emitter));
                sb.Append("}");

                return sb.ToString();
            }

            if (type.IsKnownType(KnownTypeCode.String))
            {
                return "string";
            }

            if (type.IsKnownType(KnownTypeCode.Boolean))
            {
                return "boolean";
            }

            if (type.IsKnownType(KnownTypeCode.Void))
            {
                return "void";
            }

            if (type.IsKnownType(KnownTypeCode.Byte) ||
                type.IsKnownType(KnownTypeCode.Char) ||
                type.IsKnownType(KnownTypeCode.Decimal) ||
                type.IsKnownType(KnownTypeCode.Double) ||
                type.IsKnownType(KnownTypeCode.Int16) ||
                type.IsKnownType(KnownTypeCode.Int32) ||
                type.IsKnownType(KnownTypeCode.Int64) ||
                type.IsKnownType(KnownTypeCode.SByte) ||
                type.IsKnownType(KnownTypeCode.Single) ||
                type.IsKnownType(KnownTypeCode.UInt16) ||
                type.IsKnownType(KnownTypeCode.UInt32) ||
                type.IsKnownType(KnownTypeCode.UInt64))
            {
                return "number";
            }

            if (type.Kind == TypeKind.Array)
            {
                ICSharpCode.NRefactory.TypeSystem.ArrayType arrayType = (ICSharpCode.NRefactory.TypeSystem.ArrayType)type;
                return BridgeTypes.ToTypeScriptName(arrayType.ElementType, emitter, asDefinition, excludens) + "[]";
            }

            if (type.Kind == TypeKind.Dynamic)
            {
                return "any";
            }

            if (type.Kind == TypeKind.Enum && type.DeclaringType != null && !excludens)
            {
                return "number";
            }

            if (NullableType.IsNullable(type))
            {
                return BridgeTypes.ToTypeScriptName(NullableType.GetUnderlyingType(type), emitter, asDefinition, excludens);
            }

            BridgeType bridgeType = emitter.BridgeTypes.Get(type, true);
            //string name = BridgeTypes.ConvertName(excludens ? type.Name : type.FullName);

            var name = excludens ? "" : type.Namespace;

            var hasTypeDef = bridgeType != null && bridgeType.TypeDefinition != null;
            if (hasTypeDef)
            {
                var typeDef = bridgeType.TypeDefinition;
                if (typeDef.IsNested && !excludens)
                {
                    name = (string.IsNullOrEmpty(name) ? "" : (name + ".")) + BridgeTypes.GetParentNames(typeDef);
                }
//.........这里部分代码省略.........
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:101,代码来源:BridgeType.cs

示例12: CreateDelegateDataProvider

			public IParameterDataProvider CreateDelegateDataProvider(int startOffset, IType type)
			{
				Assert.IsTrue(type.Kind != TypeKind.Unknown);
				return new Provider {
					Data = new [] { type.GetDelegateInvokeMethod () }
				};
			}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:7,代码来源:ParameterCompletionTests.cs

示例13: ToJavascriptName

        public static string ToJavascriptName(IType type, IEmitter emitter)
        {
            if (type.Kind == TypeKind.Delegate)
            {
                var delegateName = BridgeTypes.ConvertName(type.FullName);

                if (!emitter.JsDoc.Callbacks.Contains(delegateName))
                {
                    var method = type.GetDelegateInvokeMethod();
                    JsDocComment comment = new JsDocComment();

                    var parameters = method.Parameters;

                    if (parameters != null && parameters.Count > 0)
                    {
                        foreach (var param in parameters)
                        {
                            var jsParam = new JsDocParam();
                            jsParam.Name = param.Name;
                            jsParam.Type = XmlToJsDoc.ToJavascriptName(param.Type, emitter);

                            comment.Parameters.Add(jsParam);
                        }
                    }

                    comment.Returns.Add(new JsDocParam
                    {
                        Type = XmlToJsDoc.ToJavascriptName(method.ReturnType, emitter)
                    });

                    comment.Callback = delegateName;
                    comment.MemberOf = type.Namespace;

                    if (!emitter.JsDoc.Namespaces.Contains(type.Namespace))
                    {
                        emitter.JsDoc.Namespaces.Add(type.Namespace);
                        comment.Namespace = type.Namespace;
                    }

                    emitter.JsDoc.Callbacks.Add(delegateName);
                    emitter.Output.Insert(0, comment.ToString() + newLine + newLine);
                }

                return delegateName;
            }

            if (type.IsKnownType(KnownTypeCode.String))
            {
                return "string";
            }

            if (type.IsKnownType(KnownTypeCode.Boolean))
            {
                return "boolean";
            }

            if (type.IsKnownType(KnownTypeCode.Void))
            {
                return "void";
            }

            if (type.IsKnownType(KnownTypeCode.Byte) ||
                type.IsKnownType(KnownTypeCode.Char) ||
                type.IsKnownType(KnownTypeCode.Decimal) ||
                type.IsKnownType(KnownTypeCode.Double) ||
                type.IsKnownType(KnownTypeCode.Int16) ||
                type.IsKnownType(KnownTypeCode.Int32) ||
                type.IsKnownType(KnownTypeCode.Int64) ||
                type.IsKnownType(KnownTypeCode.SByte) ||
                type.IsKnownType(KnownTypeCode.Single) ||
                type.IsKnownType(KnownTypeCode.UInt16) ||
                type.IsKnownType(KnownTypeCode.UInt32) ||
                type.IsKnownType(KnownTypeCode.UInt64))
            {
                return "number";
            }

            if (type.Kind == TypeKind.Array)
            {
                ICSharpCode.NRefactory.TypeSystem.ArrayType arrayType = (ICSharpCode.NRefactory.TypeSystem.ArrayType)type;
                return "Array.<" + XmlToJsDoc.ToJavascriptName(arrayType.ElementType, emitter) + ">";
            }

            if (type.Kind == TypeKind.Dynamic)
            {
                return "object";
            }

            if (type.Kind == TypeKind.Enum && type.DeclaringType != null)
            {
                return "number";
            }

            if (NullableType.IsNullable(type))
            {
                return "?" + XmlToJsDoc.ToJavascriptName(NullableType.GetUnderlyingType(type), emitter);
            }

            BridgeType bridgeType = emitter.BridgeTypes.Get(type, true);
            //string name = BridgeTypes.ConvertName(type.FullName);
//.........这里部分代码省略.........
开发者ID:TinkerWorX,项目名称:Bridge,代码行数:101,代码来源:XmlToJsDoc.cs

示例14: AddDelegateHandlers

		string AddDelegateHandlers(CompletionDataWrapper completionList, IType delegateType, bool addSemicolon = true, bool addDefault = true, string optDelegateName = null)
		{
			IMethod delegateMethod = delegateType.GetDelegateInvokeMethod();
			PossibleDelegates.Add(delegateMethod);
			var thisLineIndent = GetLineIndent(location.Line);
			string delegateEndString = EolMarker + thisLineIndent + "}" + (addSemicolon ? ";" : "");
			//bool containsDelegateData = completionList.Result.Any(d => d.DisplayText.StartsWith("delegate("));
			if (addDefault && !completionList.AnonymousDelegateAdded) {
				completionList.AnonymousDelegateAdded = true;
				var oldDelegate = completionList.Result.FirstOrDefault(cd => cd.DisplayText == "delegate");
				if (oldDelegate != null)
					completionList.Result.Remove(oldDelegate);
				completionList.AddCustom(
					"delegate",
					"Creates anonymous delegate.",
					"delegate {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
				).DisplayFlags |= DisplayFlags.MarkedBold;
				if (LanguageVersion.Major >= 5) {
					completionList.AddCustom(
						"async delegate",
						"Creates anonymous async delegate.",
						"async delegate {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
					).DisplayFlags |= DisplayFlags.MarkedBold;
				}
			}
			var sb = new StringBuilder("(");
			var sbWithoutTypes = new StringBuilder("(");
			var state = GetState();
			var builder = new TypeSystemAstBuilder(state);

			for (int k = 0; k < delegateMethod.Parameters.Count; k++) {

				if (k > 0) {
					sb.Append(", ");
					sbWithoutTypes.Append(", ");
				}
				var convertedParameter = builder.ConvertParameter(delegateMethod.Parameters [k]);
				if (convertedParameter.ParameterModifier == ParameterModifier.Params)
					convertedParameter.ParameterModifier = ParameterModifier.None;
				sb.Append(convertedParameter.ToString(FormattingPolicy));
				sbWithoutTypes.Append(delegateMethod.Parameters [k].Name);
			}

			sb.Append(")");
			sbWithoutTypes.Append(")");
			var signature = sb.ToString();
			if (!completionList.HasAnonymousDelegateAdded(signature)) {
				completionList.AddAnonymousDelegateAdded(signature);

				completionList.AddCustom(
					"delegate" + signature,
					"Creates anonymous delegate.",
					"delegate" + signature + " {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
				).DisplayFlags |= DisplayFlags.MarkedBold;
				if (LanguageVersion.Major >= 5) {
					completionList.AddCustom(
						"async delegate" + signature,
						"Creates anonymous async delegate.",
						"async delegate" + signature + " {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString
					).DisplayFlags |= DisplayFlags.MarkedBold;
				}
				if (!completionList.Result.Any(data => data.DisplayText == sb.ToString())) {
					completionList.AddCustom(
						signature,
						"Creates typed lambda expression.",
						signature + " => |" + (addSemicolon ? ";" : "")
					).DisplayFlags |= DisplayFlags.MarkedBold;
					if (LanguageVersion.Major >= 5) {
						completionList.AddCustom(
							"async " + signature,
							"Creates typed async lambda expression.",
							"async " + signature + " => |" + (addSemicolon ? ";" : "")
						).DisplayFlags |= DisplayFlags.MarkedBold;
					}

					if (!delegateMethod.Parameters.Any(p => p.IsOut || p.IsRef) && !completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) {
						completionList.AddCustom(
							sbWithoutTypes.ToString(),
							"Creates lambda expression.",
							sbWithoutTypes + " => |" + (addSemicolon ? ";" : "")
						).DisplayFlags |= DisplayFlags.MarkedBold;
						if (LanguageVersion.Major >= 5) {
							completionList.AddCustom(
								"async " + sbWithoutTypes,
								"Creates async lambda expression.",
								"async " + sbWithoutTypes + " => |" + (addSemicolon ? ";" : "")
							).DisplayFlags |= DisplayFlags.MarkedBold;
						}
					}
				}

			}

			string varName = optDelegateName ?? "Handle" + delegateType.Name;

			var ecd = factory.CreateEventCreationCompletionData(varName, delegateType, null, signature, currentMember, currentType);
			ecd.DisplayFlags |= DisplayFlags.MarkedBold;
			completionList.Add(ecd);

			return sb.ToString();
//.........这里部分代码省略.........
开发者ID:cruwel,项目名称:NRefactory,代码行数:101,代码来源:CSharpCompletionEngine.cs

示例15: Visit

 private TsTypeRef Visit(IType type)
 {
     if(type==null)
         return new TsTypeRef { Name = "void" };
     var typeDef = type.GetDefinition();
     if (typeDef!=null)
     {
         var ktc = typeDef.KnownTypeCode;
         if(ktc != KnownTypeCode.None)
         {
             if (ktc==KnownTypeCode.Void)
                 return new TsTypeRef { Name = "void" };
             else if (ktc== KnownTypeCode.Object)
                 return new TsTypeRef { Name = "any" };
             else if (ktc == KnownTypeCode.String)
                 return new TsTypeRef { Name = "string" };
             else if (ktc == KnownTypeCode.Boolean)
                 return new TsTypeRef { Name = "boolean" };
             else if (ktc == KnownTypeCode.Int32
                 || ktc == KnownTypeCode.Int32
                 || ktc == KnownTypeCode.Int16
                 || ktc == KnownTypeCode.Int64
                 || ktc == KnownTypeCode.Double
                 || ktc == KnownTypeCode.Single
                 || ktc == KnownTypeCode.SByte
                 || ktc == KnownTypeCode.Byte
                 || ktc == KnownTypeCode.UInt16
                 || ktc == KnownTypeCode.UInt32
                 || ktc == KnownTypeCode.UInt64
                 || ktc == KnownTypeCode.Decimal
                 )
                 return new TsTypeRef { Name = "number" };
         }
         if (Sk.IsJsonMode(typeDef))
             return new TsTypeRef { Name = "Object" };
         if (type.Kind == TypeKind.Delegate && !Sk.IsJsExported(type.GetDefinition()))
         {
             var func = Visit(type.GetDelegateInvokeMethod());
             func.Name = null;
             func.IsCallSignature = true;
             return new TsTypeRef { AnonymousCallSignature = func};
         }
     }
     var tr2 = new TsTypeRef { Name = SkJs.GetEntityJsName(type) };
     tr2.GenericArguments = type.TypeArguments.Select(Visit).ToList();
     if (tr2.Name == "Array" && tr2.GenericArguments.Count == 0)
     {
         tr2.GenericArguments.Add(new TsTypeRef { Name = "any" });
     }
     return tr2;
 }
开发者ID:benbon,项目名称:SharpKit,代码行数:51,代码来源:TsMemberConverter.cs


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