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


C# XamlMember.ToString方法代码示例

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


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

示例1: WriteStartMember

 public override void WriteStartMember(XamlMember property)
 {
     this.ThrowIfDisposed();
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     this._deferringWriter.WriteStartMember(property);
     if (!this._deferringWriter.Handled)
     {
         string message = null;
         if (this._nextNodeMustBeEndMember)
         {
             message = System.Xaml.SR.Get("ValueMustBeFollowedByEndMember");
         }
         else if (property == XamlLanguage.UnknownContent)
         {
             message = System.Xaml.SR.Get("TypeHasNoContentProperty", new object[] { this._context.CurrentType });
         }
         else if (property.IsUnknown)
         {
             message = System.Xaml.SR.Get("CantSetUnknownProperty", new object[] { property.ToString() });
         }
         else if (this._context.CurrentProperty != null)
         {
             message = System.Xaml.SR.Get("OpenPropertyInCurrentFrame_SM", new object[] { this._context.CurrentType.ToString(), this._context.CurrentProperty.ToString(), property.ToString() });
         }
         else if (this._context.CurrentType == null)
         {
             message = System.Xaml.SR.Get("NoTypeInCurrentFrame_SM", new object[] { property.ToString() });
         }
         if (message != null)
         {
             throw this.WithLineInfo(new XamlObjectWriterException(message));
         }
         this._context.CurrentProperty = property;
         this.Logic_DuplicatePropertyCheck(this._context, property, false);
         if (this._context.CurrentInstance == null)
         {
             if (!this.IsConstructionDirective(this._context.CurrentProperty) && !this.IsDirectiveAllowedOnNullInstance(this._context.CurrentProperty, this._context.CurrentType))
             {
                 this.Logic_CreateAndAssignToParentStart(this._context);
             }
             if (property == XamlLanguage.PositionalParameters)
             {
                 this._context.CurrentCollection = new List<PositionalParameterDescriptor>();
             }
         }
         else
         {
             if (this.IsTextConstructionDirective(property))
             {
                 throw this.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("LateConstructionDirective", new object[] { property.Name })));
             }
             if (this._context.CurrentIsTypeConvertedObject)
             {
                 if (!property.IsDirective && !property.IsAttachable)
                 {
                     throw this.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("SettingPropertiesIsNotAllowed", new object[] { property.Name })));
                 }
                 if (property.IsAttachable && (this._context.CurrentInstance is NameFixupToken))
                 {
                     NameFixupToken currentInstance = (NameFixupToken) this._context.CurrentInstance;
                     throw this.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("AttachedPropOnFwdRefTC", new object[] { property, this._context.CurrentType, string.Join(", ", currentInstance.NeededNames.ToArray()) })));
                 }
             }
         }
         if ((property.IsDirective && (property != XamlLanguage.Items)) && (property != XamlLanguage.PositionalParameters))
         {
             XamlType type = property.Type;
             if (type.IsCollection || type.IsDictionary)
             {
                 this._context.CurrentCollection = this.Runtime.CreateInstance(property.Type, null);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:77,代码来源:XamlObjectWriter.cs

示例2: EqualsTest

		public void EqualsTest ()
		{
			XamlMember m;
			var xt = XamlLanguage.Type;
			m = new XamlMember ("Type", xt, false);
			var type_type = xt.GetMember ("Type");
			Assert.AreNotEqual (m, xt.GetMember ("Type"), "#1"); // whoa!
			Assert.AreNotEqual (type_type, m, "#2"); // whoa!
			Assert.AreEqual (type_type, xt.GetMember ("Type"), "#3");
			Assert.AreEqual (type_type.ToString (), m.ToString (), "#4");

			Assert.AreEqual (xt.GetAllMembers ().FirstOrDefault (mm => mm.Name == "Type"), xt.GetAllMembers ().FirstOrDefault (mm => mm.Name == "Type"), "#5");
			Assert.AreEqual (xt.GetAllMembers ().FirstOrDefault (mm => mm.Name == "Type"), xt.GetMember ("Type"), "#6");

			// different XamlSchemaContext
			Assert.AreNotEqual (m, XamlLanguage.Type.GetMember ("Type"), "#7");
			Assert.AreNotEqual (XamlLanguage.Type.GetMember ("Type"), new XamlSchemaContext ().GetXamlType (typeof (Type)).GetMember ("Type"), "#7");
			Assert.AreEqual (XamlLanguage.Type.GetMember ("Type"), new XamlSchemaContext ().GetXamlType (typeof (TypeExtension)).GetMember ("Type"), "#8");
		}
开发者ID:Core2D,项目名称:Portable.Xaml,代码行数:19,代码来源:XamlMemberTest.cs


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