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


C# CodeDom.CodePropertyReferenceExpression类代码示例

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


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

示例1: 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

示例2: 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

示例3: Constructor0

		public void Constructor0 ()
		{
			CodePropertyReferenceExpression cpre = new CodePropertyReferenceExpression ();

			Assert.IsNotNull (cpre.PropertyName, "#1");
			Assert.AreEqual (string.Empty, cpre.PropertyName, "#2");
			Assert.IsNull (cpre.TargetObject, "#3");

			string propertyName = "mono";
			cpre.PropertyName = propertyName;
			Assert.IsNotNull (cpre.PropertyName, "#4");
			Assert.AreSame (propertyName, cpre.PropertyName, "#5");

			cpre.PropertyName = null;
			Assert.IsNotNull (cpre.PropertyName, "#6");
			Assert.AreEqual (string.Empty, cpre.PropertyName, "#7");

			CodeExpression expression = new CodeExpression ();
			cpre.TargetObject = expression;
			Assert.IsNotNull (cpre.TargetObject, "#8");
			Assert.AreSame (expression, cpre.TargetObject, "#9");

			cpre.TargetObject = null;
			Assert.IsNull (cpre.TargetObject, "#10");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:25,代码来源:CodePropertyReferenceExpressionTest.cs

示例4: BuildAddContentPlaceHolderNames

        private void BuildAddContentPlaceHolderNames(CodeMemberMethod method, string placeHolderID) {
            CodePropertyReferenceExpression propertyExpr = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "ContentPlaceHolders");
            CodeExpressionStatement stmt = new CodeExpressionStatement();
            stmt.Expression = new CodeMethodInvokeExpression(propertyExpr, "Add", new CodePrimitiveExpression(placeHolderID.ToLower(CultureInfo.InvariantCulture)));

            method.Statements.Add(stmt);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:MasterPageCodeDomTreeGenerator.cs

示例5: HandleBoolean

 public override void HandleBoolean()
 {
     this.proprefContainerField = new CodePropertyReferenceExpression(CodeBuilderCommon.varrefReadValue, "DbusBoolean");
     #if !INHERIT_FROM_INTERFACE
     base.HandleBoolean();
     #endif // !INHERIT_FROM_INTERFACE
 }
开发者ID:rneilturner,项目名称:win-tools,代码行数:7,代码来源:InProperty.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: CreateConstructor

		protected override void CreateConstructor (CodeStatementCollection localVars,
							CodeStatementCollection trueStmt)
		{
			if (pageParser.ClientTarget != null) {
				CodeExpression prop;
				prop = new CodePropertyReferenceExpression (thisRef, "ClientTarget");
				CodeExpression ct = new CodePrimitiveExpression (pageParser.ClientTarget);
				if (localVars == null)
					localVars = new CodeStatementCollection ();
				localVars.Add (new CodeAssignStatement (prop, ct));
			}

#if NET_2_0
			if (pageParser.MasterPageFile != null) {
				CodeExpression prop;
				prop = new CodePropertyReferenceExpression (thisRef, "MasterPageFile");
				CodeExpression ct = new CodePrimitiveExpression (pageParser.MasterPageFile);
				if (localVars == null)
					localVars = new CodeStatementCollection ();
				localVars.Add (new CodeAssignStatement (prop, ct));
			}
#endif

			base.CreateConstructor (localVars, trueStmt);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:25,代码来源:PageCompiler.cs

示例8: Serialize

 public override object Serialize(IDesignerSerializationManager manager, object value)
 {
     object obj2 = ((CodeDomSerializer) manager.GetSerializer(typeof(ImageList).BaseType, typeof(CodeDomSerializer))).Serialize(manager, value);
     ImageList list = value as ImageList;
     if (list != null)
     {
         StringCollection keys = list.Images.Keys;
         if (!(obj2 is CodeStatementCollection))
         {
             return obj2;
         }
         CodeExpression targetObject = base.GetExpression(manager, value);
         if (targetObject == null)
         {
             return obj2;
         }
         CodeExpression expression2 = new CodePropertyReferenceExpression(targetObject, "Images");
         if (expression2 == null)
         {
             return obj2;
         }
         for (int i = 0; i < keys.Count; i++)
         {
             if ((keys[i] != null) || (keys[i].Length != 0))
             {
                 CodeMethodInvokeExpression expression3 = new CodeMethodInvokeExpression(expression2, "SetKeyName", new CodeExpression[] { new CodePrimitiveExpression(i), new CodePrimitiveExpression(keys[i]) });
                 ((CodeStatementCollection) obj2).Add(expression3);
             }
         }
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:ImageListCodeDomSerializer.cs

示例9: GenerateSetMappedPropertyCode

        protected CodeStatementCollection GenerateSetMappedPropertyCode(CodeExpression targetObj, CodeExpression value)
        {
            CodeStatementCollection statements = new CodeStatementCollection();

            CodePropertyReferenceExpression property = new CodePropertyReferenceExpression(targetObj, MappedProperty.Name);

            if (_mappedProperty.PropertyType.IsArray)
            {
                statements.Add(new CodeAssignStatement(
                    new CodeIndexerExpression(property, new CodePrimitiveExpression(_index)), value));
                return statements;
            }

            if (IsCollection(_mappedProperty.PropertyType))
            {
                CodeBinaryOperatorExpression isNull =
                    new CodeBinaryOperatorExpression(property, CodeBinaryOperatorType.ValueEquality, new CodeSnippetExpression("null"));
                CodeAssignStatement create = new CodeAssignStatement(property, new CodeObjectCreateExpression(_mappedProperty.PropertyType));

                statements.Add(new CodeConditionStatement(isNull, create));
                statements.Add(new CodeMethodInvokeExpression(property, "Add", value));
                return statements;
            }

            statements.Add(new CodeAssignStatement(property, value));
            return statements;
        }
开发者ID:anddudek,项目名称:anjlab.fx,代码行数:27,代码来源:MapElement.cs

示例10: GenerateXmlType

		void GenerateXmlType (XmlQualifiedName qname)
		{
			var cns = GetCodeNamespace (qname.Namespace);
			var td = new CodeTypeDeclaration () {
				Name = GetUniqueName (CodeIdentifier.MakeValid (qname.Name), cns),
				TypeAttributes = GenerateInternal ? TypeAttributes.NotPublic : TypeAttributes.Public,
				IsPartial = true };
			cns.Types.Add (td);
			td.BaseTypes.Add (new CodeTypeReference (typeof (IXmlSerializable)));

			var thisNodes = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Nodes"); // property this.Nodes
			var xmlSerializableServices = new CodeTypeReferenceExpression (typeof (XmlSerializableServices)); // static XmlSerializableServices.
			var qnameType = new CodeTypeReference (typeof (XmlQualifiedName));

			// XmlQualifiedName qname = new XmlQualifiedName ({qname.Name}, {qname.Namespace});
			td.Members.Add (new CodeMemberField () { Name = "qname", Type = qnameType, InitExpression = new CodeObjectCreateExpression (qnameType, new CodePrimitiveExpression (qname.Name), new CodePrimitiveExpression (qname.Namespace)) });

			// public XmlNode[] Nodes { get; set; }
			td.Members.Add (new CodeMemberProperty () { Name = "Nodes", Type = new CodeTypeReference (typeof (XmlNode [])), Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final, HasGet = true, HasSet = true });

			// public void ReadXml(XmlReader reader) {
			var read = new CodeMemberMethod () { Name = "ReadXml", Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final };
			read.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeof (XmlReader)), "reader"));
			//   this.Nodes = XmlSerializableServices.ReadXml(reader);
			read.Statements.Add (
				new CodeAssignStatement (thisNodes,
					new CodeMethodInvokeExpression (
						new CodeMethodReferenceExpression (xmlSerializableServices, "ReadXml"),
						new CodeArgumentReferenceExpression ("reader"))));
			// }
			td.Members.Add (read);

			// public void WriteXml(XmlWriter writer) {
			var write = new CodeMemberMethod () { Name = "WriteXml",Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final };
			write.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeof (XmlWriter)), "writer"));
			//   XmlSerializableServices.WriteXml(writer, this.Nodes);
			write.Statements.Add (
				new CodeMethodInvokeExpression (
					new CodeMethodReferenceExpression (xmlSerializableServices, "WriteXml"),
					new CodeArgumentReferenceExpression ("writer"),
					thisNodes));
			// }
			td.Members.Add (write);

			// public XmlSchema GetSchema () { return null; }
			var getSchema = new CodeMemberMethod () { Name = "GetSchema", Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final, ReturnType = new CodeTypeReference (typeof (XmlSchema)) };
			getSchema.Statements.Add (new CodeMethodReturnStatement (new CodePrimitiveExpression (null)));
			td.Members.Add (getSchema);

			// public static XmlQualifiedName ExportSchema (XmlSchemaSet schemas) {
			var export = new CodeMemberMethod () { Name = "ExportSchema", Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final | MemberAttributes.Static, ReturnType = qnameType };
			export.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeof (XmlSchemaSet)), "schemas"));
			//   XmlSerializableServices.AddDefaultSchema (schemas);
			export.Statements.Add (new CodeMethodInvokeExpression (xmlSerializableServices, "AddDefaultSchema", new CodeArgumentReferenceExpression ("schemas")));
			//   return qname;
			export.Statements.Add (new CodeMethodReturnStatement (new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), "qname")));
			// }
			td.Members.Add (export);
		}
开发者ID:carrie901,项目名称:mono,代码行数:59,代码来源:XsdDataContractImporter.cs

示例11: BuildAddContentPlaceHolderNames

 private void BuildAddContentPlaceHolderNames(CodeMemberMethod method, string placeHolderID)
 {
     CodePropertyReferenceExpression targetObject = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "ContentPlaceHolders");
     CodeExpressionStatement statement = new CodeExpressionStatement {
         Expression = new CodeMethodInvokeExpression(targetObject, "Add", new CodeExpression[] { new CodePrimitiveExpression(placeHolderID.ToLower(CultureInfo.InvariantCulture)) })
     };
     method.Statements.Add(statement);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:MasterPageCodeDomTreeGenerator.cs

示例12: Constructor0_Deny_Unrestricted

		public void Constructor0_Deny_Unrestricted ()
		{
			CodePropertyReferenceExpression cpre = new CodePropertyReferenceExpression ();
			Assert.AreEqual (String.Empty, cpre.PropertyName, "PropertyName");
			cpre.PropertyName = "mono";
			Assert.IsNull (cpre.TargetObject, "TargetObject");
			cpre.TargetObject = new CodeExpression ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodePropertyReferenceExpressionCas.cs

示例13: Constructor1_Deny_Unrestricted

		public void Constructor1_Deny_Unrestricted ()
		{
			CodeExpression target = new CodeExpression ();
			CodePropertyReferenceExpression cpre = new CodePropertyReferenceExpression (target, "mono");
			Assert.AreEqual ("mono", cpre.PropertyName, "PropertyName");
			cpre.PropertyName = String.Empty;
			Assert.AreSame (target, cpre.TargetObject, "TargetObject");
			cpre.TargetObject = new CodeExpression ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:CodePropertyReferenceExpressionCas.cs

示例14: Clone

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

示例15: GetClassCodeForProcessingRun

		public override string GetClassCodeForProcessingRun ()
		{
			var hostProp = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Host");
			return TemplatingEngine.GenerateIndentedClassCode (
				languageProvider,
				CreateIsTrueMethod (hostProp),
				CreateTagsProperty (hostProp)
			);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:FileTemplateDirectiveProcessor.cs


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