本文整理汇总了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);
}
}
}
}
示例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");
}