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


C# CodeDom.CodeTypeReferenceExpression类代码示例

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


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

示例1: ImportClass

 public override void ImportClass()
 {
     SoapAddressBinding binding = (base.ImportContext.Port == null) ? null : ((SoapAddressBinding) base.ImportContext.Port.Extensions.Find(typeof(SoapAddressBinding)));
     if (base.ImportContext.Style == ServiceDescriptionImportStyle.Client)
     {
         base.ImportContext.CodeTypeDeclaration.BaseTypes.Add(typeof(SoapHttpClientProtocol).FullName);
         CodeConstructor ctor = WebCodeGenerator.AddConstructor(base.ImportContext.CodeTypeDeclaration, new string[0], new string[0], null, CodeFlags.IsPublic);
         ctor.Comments.Add(new CodeCommentStatement(Res.GetString("CodeRemarks"), true));
         bool flag = true;
         if (base.ImportContext is Soap12ProtocolImporter)
         {
             flag = false;
             CodeTypeReferenceExpression targetObject = new CodeTypeReferenceExpression(typeof(SoapProtocolVersion));
             CodeFieldReferenceExpression right = new CodeFieldReferenceExpression(targetObject, Enum.Format(typeof(SoapProtocolVersion), SoapProtocolVersion.Soap12, "G"));
             CodePropertyReferenceExpression left = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "SoapVersion");
             CodeAssignStatement statement = new CodeAssignStatement(left, right);
             ctor.Statements.Add(statement);
         }
         ServiceDescription serviceDescription = base.ImportContext.Binding.ServiceDescription;
         string url = (binding != null) ? binding.Location : null;
         string appSettingUrlKey = serviceDescription.AppSettingUrlKey;
         string appSettingBaseUrl = serviceDescription.AppSettingBaseUrl;
         ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, appSettingUrlKey, appSettingBaseUrl, flag && !base.ImportContext.IsEncodedBinding);
     }
     else if (base.ImportContext.Style == ServiceDescriptionImportStyle.Server)
     {
         base.ImportContext.CodeTypeDeclaration.BaseTypes.Add(typeof(WebService).FullName);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:SoapHttpTransportImporter.cs

示例2: ImportClass

 public override void ImportClass() {
     // grab this here so it gets marked "handled" for both client and server
     SoapAddressBinding soapAddress = ImportContext.Port == null ? null : (SoapAddressBinding)ImportContext.Port.Extensions.Find(typeof(SoapAddressBinding));
     if (ImportContext.Style == ServiceDescriptionImportStyle.Client) {
         ImportContext.CodeTypeDeclaration.BaseTypes.Add(typeof(SoapHttpClientProtocol).FullName);                                
         CodeConstructor ctor = WebCodeGenerator.AddConstructor(ImportContext.CodeTypeDeclaration, new string[0], new string[0], null, CodeFlags.IsPublic);
         ctor.Comments.Add(new CodeCommentStatement(Res.GetString(Res.CodeRemarks), true));
         bool soap11 = true;
         if (ImportContext is Soap12ProtocolImporter) {
             soap11 = false;
             // add version code
             CodeTypeReferenceExpression versionEnumTypeReference = new CodeTypeReferenceExpression(typeof(SoapProtocolVersion));
             CodeFieldReferenceExpression versionEnumFieldReference = new CodeFieldReferenceExpression(versionEnumTypeReference, Enum.Format(typeof(SoapProtocolVersion), SoapProtocolVersion.Soap12, "G"));
             CodePropertyReferenceExpression versionPropertyReference = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "SoapVersion");
             CodeAssignStatement assignVersionStatement = new CodeAssignStatement(versionPropertyReference, versionEnumFieldReference);
             ctor.Statements.Add(assignVersionStatement);
         }
         ServiceDescription serviceDescription = ImportContext.Binding.ServiceDescription;
         string url = (soapAddress != null) ? soapAddress.Location : null;
         string urlKey = serviceDescription.AppSettingUrlKey;
         string baseUrl = serviceDescription.AppSettingBaseUrl;
         ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, urlKey, baseUrl, soap11 && !ImportContext.IsEncodedBinding);
     }
     else if (ImportContext.Style == ServiceDescriptionImportStyle.Server) {
         ImportContext.CodeTypeDeclaration.BaseTypes.Add(typeof(WebService).FullName);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:27,代码来源:SoapHttpTransportImporter.cs

示例3: Constructor1_Deny_Unrestricted

		public void Constructor1_Deny_Unrestricted ()
		{
			CodeTypeReference type = new CodeTypeReference ("System.Int32");
			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression (type);
			Assert.AreSame (type, ctre.Type, "Type");
			ctre.Type = new CodeTypeReference ("System.Void");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeTypeReferenceExpressionCas.cs

示例4: CodeTypeOperationExpression

 /// <summary>
 /// Initializes a new instance of the CodeTypeOperationExpression class.
 /// </summary>
 /// <param name="source">The source expression.</param>
 /// <param name="targetType">The target type reference expression.</param>
 protected CodeTypeOperationExpression(CodeExpression source, CodeTypeReferenceExpression targetType)
 {
     ExceptionUtilities.CheckArgumentNotNull(source, "source");
     ExceptionUtilities.CheckArgumentNotNull(targetType, "targetType");
     this.Source = source;
     this.TargetType = targetType;
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:12,代码来源:CodeTypeOperationExpression.cs

示例5: Is

 public static CodeExpression Is(CodeVariableReferenceExpression var,
     CodeTypeReferenceExpression type, CodeDomProvider provider)
 {
     return new CodeSnippetExpression(
         "((" + ExpressionToString(var, provider) + ") is " +
         ExpressionToString(type, provider) + ")");
 }
开发者ID:smoothfriction,项目名称:SmoothReflections,代码行数:7,代码来源:IltoCSharpConverter.cs

示例6: DeserializeAppConfigExpression

 private static CodePropertyReferenceExpression DeserializeAppConfigExpression(string[] expressionParts)
 {
     int index = expressionParts.Length - 1;
     CodePropertyReferenceExpression expression = new CodePropertyReferenceExpression {
         PropertyName = expressionParts[index]
     };
     index--;
     CodeIndexerExpression expression2 = new CodeIndexerExpression();
     expression.TargetObject = expression2;
     expression2.Indices.Add(new CodePrimitiveExpression(expressionParts[index]));
     index--;
     CodePropertyReferenceExpression expression3 = new CodePropertyReferenceExpression();
     expression2.TargetObject = expression3;
     expression3.PropertyName = expressionParts[index];
     index--;
     CodeTypeReferenceExpression expression4 = new CodeTypeReferenceExpression();
     expression3.TargetObject = expression4;
     expression4.Type.Options = (CodeTypeReferenceOptions) Enum.Parse(typeof(CodeTypeReferenceOptions), expressionParts[index]);
     index--;
     expression4.Type.BaseType = expressionParts[index];
     index--;
     while (index > 0)
     {
         expression4.Type.BaseType = expressionParts[index] + "." + expression4.Type.BaseType;
         index--;
     }
     return expression;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:PropertyReferenceSerializer.cs

示例7: CreateService

        protected override CodeMemberMethod CreateService(CodeTypeReference typerefWCFService, CodeTypeReference typerefService)
        {
            CodeTypeReferenceExpression typerefexprService = new CodeTypeReferenceExpression(typerefService);
            CodeMethodReferenceExpression methodrefDbusServiceCreate = new CodeMethodReferenceExpression(typerefexprService, "Create");

            CodeMemberMethod methodCreateService = new CodeMemberMethod();
            methodCreateService.Name = CreateServiceName;
            methodCreateService.ReturnType = typerefWCFService;
            methodCreateService.Attributes = MemberAttributes.Static;
            methodCreateService.Parameters.Add(new CodeParameterDeclarationExpression(CodeBuilderCommon.typerefWCFServiceParams, nameWCFServiceParamsArg));
            CodeMethodReferenceExpression methodrefCreateDbusService = new CodeMethodReferenceExpression(CodeBuilderCommon.typerefexprLookupTargetFunctions, CodeBuilderCommon.CreateDbusService);
            methodrefCreateDbusService.TypeArguments.Add(typerefService);

            methodCreateService.Statements.Add(new CodeVariableDeclarationStatement(typerefService, dbusService, // * <dbus_service> dbusService =
                new CodeMethodInvokeExpression(methodrefCreateDbusService // * Udbus.WCF.Dbus.Service.LookupTargetFunctions.CreateDbusService(
                    , argrefWCFServiceParams // * wcfserviceparams
                    , methodrefDbusServiceCreate // * , <dbus_service>.Create // createService1
                    , methodrefDbusServiceCreate // * , <dbus_service>.Create // createService2
                    , new CodePropertyReferenceExpression(typerefexprService, CodeBuilderCommon.DefaultConnectionParameters) // * <dbus_service>.DefaultConnectionParameters);
                )
            ));

            // * <wcfservice> wcfService = new <wcfservice>(dbusservice);
            methodCreateService.Statements.Add(new CodeVariableDeclarationStatement(typerefWCFService, wcfService
                , new CodeObjectCreateExpression(typerefWCFService, varrefDbusService)
            ));

            // return wcfService;
            methodCreateService.Statements.Add(new CodeMethodReturnStatement(varrefWcfService));
            return methodCreateService;
        }
开发者ID:jean-edouard,项目名称:win-tools,代码行数:31,代码来源:WCFPassthruHostBuilder.cs

示例8: GetCodeExpression

        public override CodeExpression GetCodeExpression(BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)
        {
            if (!entry.Expression.Contains(","))
              {
            throw new ArgumentException("Must include two numbers separated by a comma.");
              }
              else
              {
            // get two numbers
            string[] numbers = entry.Expression.Split(',');
            if (numbers.Length != 2)
            {
              throw new ArgumentException("Only include two numbers");
            }
            else
            {
              int lowerLimit, upperLimit;
              if (Int32.TryParse(numbers[0], out lowerLimit) && Int32.TryParse(numbers[1], out upperLimit))
              {
            CodeTypeReferenceExpression typeRef = new CodeTypeReferenceExpression(this.GetType());
            CodeExpression[] methodParameters = new CodeExpression[2];
            methodParameters[0] = new CodePrimitiveExpression(lowerLimit);
            methodParameters[1] = new CodePrimitiveExpression(upperLimit);

            return new CodeMethodInvokeExpression(typeRef, "GetRandomNumber", methodParameters);
              }
              else
              {
            throw new ArgumentException("Use valid Integers");
              }
            }
              }
        }
开发者ID:bq-wang,项目名称:aspnet,代码行数:33,代码来源:RandomNumberExpressionBuilder.cs

示例9: Init

		void Init ()
		{
			unit = new CodeCompileUnit ();
			mainNS = new CodeNamespace ("ASP");
			unit.Namespaces.Add (mainNS);
			mainClass = new CodeTypeDeclaration (parser.ClassName);
			mainClass.TypeAttributes = TypeAttributes.Public;
			mainNS.Types.Add (mainClass);
			mainClass.BaseTypes.Add (new CodeTypeReference (parser.BaseType.FullName));
			mainClassExpr = new CodeTypeReferenceExpression ("ASP." + parser.ClassName);
			foreach (object o in parser.Imports) {
				if (o is string)
					mainNS.Imports.Add (new CodeNamespaceImport ((string) o));
			}

			if (parser.Assemblies != null) {
				foreach (object o in parser.Assemblies) {
					if (o is string)
						unit.ReferencedAssemblies.Add ((string) o);
				}
			}

			// Late-bound generators specifics (as for MonoBASIC/VB.NET)
			unit.UserData["RequireVariableDeclaration"] = parser.ExplicitOn;
			unit.UserData["AllowLateBound"] = !parser.StrictOn;
			
			AddInterfaces ();
			AddClassAttributes ();
			CreateStaticFields ();
			AddApplicationAndSessionObjects ();
			AddScripts ();
			CreateConstructor (null, null);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:BaseCompiler.cs

示例10: Clone

 public static CodeTypeReferenceExpression Clone(this CodeTypeReferenceExpression expression)
 {
     if (expression == null) return null;
     CodeTypeReferenceExpression e = new CodeTypeReferenceExpression();
     e.Type = expression.Type.Clone();
     e.UserData.AddRange(expression.UserData);
     return e;
 }
开发者ID:jw56578,项目名称:SpecFlowTest,代码行数:8,代码来源:CodeTypeReferenceExpressionExtensions.cs

示例11: GetCodeExpression

        public override CodeExpression GetCodeExpression(BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)
        {
            string property = (string) parsedData;

            CodePrimitiveExpression prim = new CodePrimitiveExpression(property);
            CodeExpression[] args = new[] {prim};
            CodeTypeReferenceExpression refType = new CodeTypeReferenceExpression(this.GetType());
            return new CodeMethodInvokeExpression(refType, "GetProperty", args);
        }
开发者ID:dreamer777,项目名称:My.Common,代码行数:9,代码来源:ConfigExpressionBuilder.cs

示例12: TypescriptTypeReferenceExpression

 public TypescriptTypeReferenceExpression(
     CodeTypeReferenceExpression codeExpression,
     CodeGeneratorOptions options,
     ITypescriptTypeMapper typescriptTypeMapper)
 {
     _codeExpression = codeExpression;
     _options = options;
     _typescriptTypeMapper = typescriptTypeMapper;
     System.Diagnostics.Debug.WriteLine("TypescriptTypeReferenceExpression Created");
 }
开发者ID:s2quake,项目名称:TypescriptCodeDom,代码行数:10,代码来源:TypescriptTypeReferenceExpression.cs

示例13: CreateEmptyConstructor

        internal CodeConstructor CreateEmptyConstructor()
        {
            // Example:  new TestService() : this(NullAuthenticator.Instance)
            var constructor = new CodeConstructor();

            constructor.Attributes = MemberAttributes.Public;
            var nullAuthenticator = new CodeTypeReferenceExpression(typeof(NullAuthenticator));
            constructor.ChainedConstructorArgs.Add(new CodeFieldReferenceExpression(nullAuthenticator, "Instance"));
            return constructor;
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:10,代码来源:EasyConstructServiceDecorator.cs

示例14: Constructor2

		public void Constructor2 ()
		{
			string baseType = "mono";

			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression (baseType);
			Assert.IsNotNull (ctre.Type, "#1");
			Assert.AreEqual (baseType, ctre.Type.BaseType, "#2");

			ctre = new CodeTypeReferenceExpression ((string) null);
			Assert.IsNotNull (ctre.Type, "#3");
			Assert.AreEqual (typeof (void).FullName, ctre.Type.BaseType, "#4");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:CodeTypeReferenceExpressionTest.cs

示例15: GetCodeExpression

        public override CodeExpression GetCodeExpression(System.Web.UI.BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)
        {
            _log.Write(_id, SPTraceLogger.TraceSeverity.InformationEvent, "GetCodeExpression", "Info", "Called");

            CodeTypeReferenceExpression thisType = new CodeTypeReferenceExpression(base.GetType());

            CodePrimitiveExpression expression = new CodePrimitiveExpression(entry.Expression.Trim().ToString());

            string evaluationMethod = "GetKeyValue";

            return new CodeMethodInvokeExpression(thisType, evaluationMethod, new CodeExpression[] { expression });
        }
开发者ID:powareverb,项目名称:SPExpressionBuilder,代码行数:12,代码来源:SPUrlExpressionBuilder.cs


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