• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.TypeOf类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.CSharp.TypeOf的典型用法代码示例。如果您正苦于以下问题:C# TypeOf类的具体用法?C# TypeOf怎么用?C# TypeOf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypeOf类属于Mono.CSharp命名空间,在下文中一共展示了TypeOf类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Visit

			public override object Visit(TypeOf typeOfExpression)
			{
				var result = new TypeOfExpression();
				var location = LocationsBag.GetLocations(typeOfExpression);
				result.AddChild(new CSharpTokenNode(Convert(typeOfExpression.Location), TypeOfExpression.TypeofKeywordRole), TypeOfExpression.TypeofKeywordRole);
				if (location != null)
					result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
				if (typeOfExpression.TypeExpression != null)
					result.AddChild(ConvertToType(typeOfExpression.TypeExpression), Roles.Type);
				if (location != null && location.Count > 1)
					result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:13,代码来源:CSharpParser.cs


示例2: Visit

			public override object Visit (TypeOf typeOfExpression)
			{
				var result = new TypeOfExpression ();
				var location = LocationsBag.GetLocations (typeOfExpression);
				result.AddChild (new CSharpTokenNode (Convert (typeOfExpression.Location), "typeof".Length), TypeOfExpression.Roles.Keyword);
				result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), TypeOfExpression.Roles.LPar);
				result.AddChild ((INode)typeOfExpression.TypeExpression.Accept (this), TypeOfExpression.Roles.ReturnType);
				result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), TypeOfExpression.Roles.RPar);
				return result;
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:10,代码来源:CSharpParser.cs


示例3: Visit

		public virtual object Visit (TypeOf typeOfExpression)
		{
			return null;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:4,代码来源:visit.cs


示例4: case_530

void case_530()
#line 3837 "cs-parser.jay"
{
	  	lexer.TypeOfParsing = false;
		yyVal = new TypeOf ((FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs


示例5: yyparse


//.........这里部分代码省略.........
  break;
case 522:
#line 3616 "cs-parser.jay"
  {
		yyVal = new ArrayInitializer ((List<Expression>) yyVals[-2+yyTop], GetLocation (yyVals[-3+yyTop]));
	  }
  break;
case 523:
#line 3623 "cs-parser.jay"
  {
		var list = new List<Expression> (4);
		list.Add ((Expression) yyVals[0+yyTop]);
		yyVal = list;
	  }
  break;
case 524:
#line 3629 "cs-parser.jay"
  {
		var list = (List<Expression>) yyVals[-2+yyTop];
		list.Add ((Expression) yyVals[0+yyTop]);
		yyVal = list;
	  }
  break;
case 525:
#line 3635 "cs-parser.jay"
  {
	  	Error_SyntaxError (yyToken);
	  	yyVal = new List<Expression> ();
	  }
  break;
case 526:
#line 3643 "cs-parser.jay"
  {
	  	lexer.TypeOfParsing = true;
	  }
  break;
case 527:
#line 3647 "cs-parser.jay"
  {
	  	lexer.TypeOfParsing = false;
		Expression type = (Expression)yyVals[-1+yyTop];
		if (type == TypeManager.system_void_expr)
			yyVal = new TypeOfVoid (GetLocation (yyVals[-4+yyTop]));
		else
			yyVal = new TypeOf (type, GetLocation (yyVals[-4+yyTop]));
	  }
  break;
case 530:
#line 3661 "cs-parser.jay"
  {
	 	Error_TypeExpected (lexer.Location);
	 	yyVal = null;
	 }
  break;
case 531:
#line 3669 "cs-parser.jay"
  {  
		var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];

		yyVal = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location);
	  }
  break;
case 532:
#line 3675 "cs-parser.jay"
  {
		var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
开发者ID:speier,项目名称:shake,代码行数:67,代码来源:cs-parser.cs


示例6: case_522

void case_522()
{
	  	lexer.TypeOfParsing = false;
		yyVal = new TypeOf ((FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:6,代码来源:cs-parser.cs


示例7: yyparse


//.........这里部分代码省略.........
		   isInteraction = false;
		}
		var method = Method.Create (current_class, generic, (FullNamedExpression) yyVals[-7+yyTop], modifiers,
				     name, current_local_parameters, (Attributes) yyVals[-9+yyTop], yyVals[0+yyTop] != null);
		if(current_container.Kind == MemberKind.Interface && current_extensionContainer != null){
		    var parameters = new List<Parameter>();
            var typeExpression = new TypeExpression (compiler.BuiltinTypes.Object, GetLocation (yyVals[-9+yyTop]));
            var parameter = new Parameter(typeExpression, "self", Parameter.Modifier.This, null, GetLocation(yyVals[-9+yyTop]));
            parameters.Add(parameter);
            parameters.Add(new Parameter(typeExpression, "ctx", Parameter.Modifier.NONE, null, GetLocation(yyVals[-9+yyTop])));
		    var clone = current_local_parameters.Clone();
		    for(var i = 0; i < clone.Count; i++){
		       parameters.Add(clone[i]);
		    }
		    
			var parameterTypeExpressions = parameters.Select(p=>p.TypeExpression).ToList();
			var key = current_namespace.NS.Name + "," + name.Name + "," + string.Join(",",parameterTypeExpressions.Select(p => p.ToString()));
			if(roleExtensionMethodDummies.Add(key)){
               var returnType = (FullNamedExpression) yyVals[-7+yyTop];
			   var parametersCompiled = new ParametersCompiled(parameters.ToArray(),false);
		       var dummy = Method.Create (current_extensionContainer, generic, (FullNamedExpression) yyVals[-7+yyTop], Modifiers.PUBLIC | Modifiers.STATIC,
				       name, parametersCompiled, (Attributes) yyVals[-9+yyTop], yyVals[0+yyTop] != null);
                var location = GetLocation(yyVals[-9+yyTop]);
				var parameterName = new SimpleName("self", null, location);
				var getTypeAccess = new MemberAccess(parameterName, "GetType", null, location);
                var getTypeExpression =  new Invocation(getTypeAccess, new Arguments(0));
                var argCount = parameterTypeExpressions.Count-1;
                var argumentsForGetMethod = new Arguments(2);
				var stringLiteral =  new StringLiteral(compiler.BuiltinTypes,name.Name,location);
                argumentsForGetMethod.Add(new Argument(stringLiteral));
				var typeName = new SimpleName("Type", null, location);
				var types = parameterTypeExpressions.Skip(2)
				                          .Select(t =>(Expression)(t.Type != null 
										                             ? new TypeOf(t.Type,location) 
																	 : new TypeOf(t,location))
									  ).ToList();
				var initializer = new ArrayInitializer(types,location);
                var parameterTypes = new ImplicitlyTypedArrayCreation (
				                           new ComposedTypeSpecifier (1, location), 
										   initializer, 
										   location);
		        lbag.AddLocation (parameterTypes, location, location);
				
                argumentsForGetMethod.Add(new Argument(parameterTypes));
                var getMethodExpression = new Invocation(new MemberAccess(getTypeExpression,"GetMethod"),argumentsForGetMethod);
                var argumentsForMethod = new Arguments(2);

                var delegatedArguments = parameters.Skip(2).Select(p =>
                         (Expression)new Cast(
                                  new TypeExpression(compiler.BuiltinTypes.Object,location),
                                  new SimpleName(p.Name,location),
                                  location)).ToList();
		        argumentsForMethod.Add(new Argument(new SimpleName("self", null, location)));
                if(delegatedArguments.Any()){
				      initializer = new ArrayInitializer(delegatedArguments,location);
				
				      argumentsForMethod.Add(new Argument(new ImplicitlyTypedArrayCreation(
				                           new ComposedTypeSpecifier (1, location), 
										   initializer, 
										   location)));
                } else {
				   argumentsForMethod.Add(new Argument(new ArrayCreation(new TypeExpression(compiler.BuiltinTypes.Object,location),new ArrayInitializer(0,location)))); 
				}    

                var invocation = new Invocation(new MemberAccess(getMethodExpression,"Invoke"),argumentsForMethod);
				Statement statement = new StatementExpression(invocation);
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs


示例8: case_528

void case_528()
#line 3607 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
	  	lexer.TypeOfParsing = false;
		yyVal = new TypeOf ((FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:7,代码来源:cs-parser.cs


示例9: case_557

void case_557()
#line 4042 "cs-parser.jay"
{
		yyVal = new TypeOf ((FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.TypeParameter类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.TypeInferenceContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap