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


C# XamlType.GetAllMembers方法代码示例

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


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

示例1: TestXamlTypePrimitive

		void TestXamlTypePrimitive (XamlType t, string name, Type underlyingType, bool nullable, bool constructorRequiresArguments)
		{
			TestXamlTypeCommon (t, name, underlyingType, nullable, constructorRequiresArguments);
			Assert.IsFalse (t.IsMarkupExtension, "#14");
			Assert.IsNotNull (t.TypeConverter, "#25");
			Assert.IsNull (t.ContentProperty, "#27");
			Assert.IsNull (t.MarkupExtensionReturnType, "#29");

			var l = t.GetAllMembers ().ToArray ();
			Assert.AreEqual (0, l.Length, "#31");
		}
开发者ID:jdecuyper,项目名称:mono,代码行数:11,代码来源:XamlLanguageTest.cs

示例2: ContentIncluded

		public void ContentIncluded ()
		{
			var xt = new XamlType (typeof (ContentIncludedClass), sctx);
			var xm = xt.GetMember ("Content");
			Assert.AreEqual (xm, xt.ContentProperty, "#1");
			Assert.IsTrue (xt.GetAllMembers ().Contains (xm), "#2");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:7,代码来源:XamlTypeTest.cs

示例3: NamedItem

		public void NamedItem ()
		{
			var xt = new XamlType (typeof (NamedItem), sctx);
			var e = xt.GetAllMembers ().GetEnumerator ();
			Assert.IsTrue (e.MoveNext (), "#1");
			Assert.AreEqual (xt.GetMember ("ItemName"), e.Current, "#2");
			Assert.IsTrue (e.MoveNext (), "#3");
			Assert.AreEqual (xt.GetMember ("References"), e.Current, "#4");
			Assert.IsFalse (e.MoveNext (), "#5");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:10,代码来源:XamlTypeTest.cs

示例4: ListMembers

		public void ListMembers ()
		{
			var xt = new XamlType (typeof (List<int>), sctx);
			var ml = xt.GetAllMembers ().ToArray ();
			Assert.AreEqual (1, ml.Length, "#1");
			Assert.IsNotNull (xt.GetMember ("Capacity"), "#2");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:7,代码来源:XamlTypeTest.cs

示例5: CustomArrayExtension

		public void CustomArrayExtension ()
		{
			var xt = new XamlType (typeof (MyArrayExtension), sctx);
			var xm = xt.GetMember ("Items");
			Assert.IsNotNull (xt.GetAllMembers ().FirstOrDefault (m => m.Name == "Items"), "#0");
			Assert.IsNotNull (xm, "#1");
			Assert.IsFalse (xm.IsReadOnly, "#2"); // Surprisingly it is False. Looks like XAML ReadOnly is true only if it lacks set accessor. Having private member does not make it ReadOnly.
			Assert.IsTrue (xm.Type.IsCollection, "#3");
			Assert.IsFalse (xm.Type.IsConstructible, "#4");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:10,代码来源:XamlTypeTest.cs

示例6: DefaultValuesArgumentAttributed

		public void DefaultValuesArgumentAttributed ()
		{
			var t = new XamlType (typeof (ArgumentAttributed), sctx);
			Assert.IsNotNull (t.Invoker, "#1");
			Assert.IsTrue (t.IsNameValid, "#2");
			Assert.IsFalse (t.IsUnknown, "#3");
			Assert.AreEqual ("ArgumentAttributed", t.Name, "#4");
			Assert.AreEqual ("clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, t.PreferredXamlNamespace, "#5");
			Assert.IsNull (t.TypeArguments, "#6");
			Assert.AreEqual (typeof (ArgumentAttributed), t.UnderlyingType, "#7");
			Assert.IsTrue (t.ConstructionRequiresArguments, "#8");
			Assert.IsFalse (t.IsArray, "#9");
			Assert.IsFalse (t.IsCollection, "#10");
			Assert.IsTrue (t.IsConstructible, "#11");
			Assert.IsFalse (t.IsDictionary, "#12");
			Assert.IsFalse (t.IsGeneric, "#13");
			Assert.IsFalse (t.IsMarkupExtension, "#14");
			Assert.IsFalse (t.IsNameScope, "#15");
			Assert.IsTrue (t.IsNullable, "#16");
			Assert.IsTrue (t.IsPublic, "#17");
			Assert.IsFalse (t.IsUsableDuringInitialization, "#18");
			Assert.IsFalse (t.IsWhitespaceSignificantCollection, "#19");
			Assert.IsFalse (t.IsXData, "#20");
			Assert.IsFalse (t.TrimSurroundingWhitespace, "#21");
			Assert.IsFalse (t.IsAmbient, "#22");
			Assert.IsNull (t.AllowedContentTypes, "#23");
			Assert.IsNull (t.ContentWrappers, "#24");
			Assert.IsNull (t.TypeConverter, "#25");
			Assert.IsNull (t.ValueSerializer, "#26");
			Assert.IsNull (t.ContentProperty, "#27");
			// Assert.IsNull (t.DeferringLoader, "#28");
			Assert.IsNull (t.MarkupExtensionReturnType, "#29");
			Assert.AreEqual (sctx, t.SchemaContext, "#30");

			var members = t.GetAllMembers ();
			Assert.AreEqual (2, members.Count, "#31");
			string [] names = {"Arg1", "Arg2"};
			foreach (var member in members)
				Assert.IsTrue (Array.IndexOf (names, member.Name) >= 0, "#32");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:40,代码来源:XamlTypeTest.cs

示例7: Dictionary

		public void Dictionary ()
		{
			var t = new XamlType (typeof (int), sctx);
			Assert.IsFalse (t.IsDictionary, "#1.1");
			Assert.IsFalse (t.IsCollection, "#1.1-2");
			Assert.IsNull (t.KeyType, "#1.2");
			t = new XamlType (typeof (Hashtable), sctx);
			Assert.IsTrue (t.IsDictionary, "#2.1");
			Assert.IsFalse (t.IsCollection, "#2.1-2");
			Assert.IsNotNull (t.KeyType, "#2.2");
			Assert.IsNotNull (t.ItemType, "#2.2-2");
			Assert.AreEqual ("Object", t.KeyType.Name, "#2.3");
			Assert.AreEqual ("Object", t.ItemType.Name, "#2.3-2");
			t = new XamlType (typeof (Dictionary<int,string>), sctx);
			Assert.IsTrue (t.IsDictionary, "#3.1");
			Assert.IsFalse (t.IsCollection, "#3.1-2");
			Assert.IsNotNull (t.KeyType, "#3.2");
			Assert.IsNotNull (t.ItemType, "#3.2-2");
			Assert.AreEqual ("Int32", t.KeyType.Name, "#3.3");
			Assert.AreEqual ("String", t.ItemType.Name, "#3.3-2");

			var ml = t.GetAllMembers ();
			Assert.AreEqual (2, ml.Count, "#3.4");
			Assert.IsTrue (ml.Any (mi => mi.Name == "Keys"), "#3.4-2");
			Assert.IsTrue (ml.Any (mi => mi.Name == "Values"), "#3.4-3");
			Assert.IsNotNull (t.GetMember ("Keys"), "#3.4-4");
			Assert.IsNotNull (t.GetMember ("Values"), "#3.4-5");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:28,代码来源:XamlTypeTest.cs

示例8: WriteNullMemberAsObject

		protected void WriteNullMemberAsObject (XamlReader r, Action validateNullInstance)
		{
			Assert.AreEqual (XamlNodeType.None, r.NodeType, "#1");
			Assert.IsTrue (r.Read (), "#6");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
			Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
			Assert.AreEqual ("clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");

			Assert.IsTrue (r.Read (), "#11");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
			Assert.AreEqual ("x", r.Namespace.Prefix, "#12-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "#12-3");

			Assert.IsTrue (r.Read (), "#16");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#17");
			var xt = new XamlType (typeof (TestClass4), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "#17-2");
//			Assert.IsTrue (r.Instance is TestClass4, "#17-3");
			Assert.AreEqual (2, xt.GetAllMembers ().Count, "#17-4");

			if (r is XamlXmlReader)
				ReadBase (r);

			Assert.IsTrue (r.Read (), "#21");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#22");
			Assert.AreEqual (xt.GetMember ("Bar"), r.Member, "#22-2");

			Assert.IsTrue (r.Read (), "#26");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#27");
			Assert.AreEqual (XamlLanguage.Null, r.Type, "#27-2");
			if (validateNullInstance != null)
				validateNullInstance ();

			Assert.IsTrue (r.Read (), "#31");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#32");

			Assert.IsTrue (r.Read (), "#36");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#37");

			Assert.IsTrue (r.Read (), "#41");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#42");
			Assert.AreEqual (xt.GetMember ("Foo"), r.Member, "#42-2");

			Assert.IsTrue (r.Read (), "#43");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#43-2");
			Assert.AreEqual (XamlLanguage.Null, r.Type, "#43-3");
			if (validateNullInstance != null)
				validateNullInstance ();

			Assert.IsTrue (r.Read (), "#44");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#44-2");

			Assert.IsTrue (r.Read (), "#46");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#47");

			Assert.IsTrue (r.Read (), "#51");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#52");

			Assert.IsFalse (r.Read (), "#56");
			Assert.IsTrue (r.IsEof, "#57");
		}
开发者ID:imphasing,项目名称:mono,代码行数:61,代码来源:XamlReaderTestBase.cs

示例9: StaticMember

		protected void StaticMember (XamlReader r)
		{
			Assert.AreEqual (XamlNodeType.None, r.NodeType, "#1");
			Assert.IsTrue (r.Read (), "#6");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
			Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
			Assert.AreEqual ("clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");

			Assert.IsTrue (r.Read (), "#11");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
			Assert.AreEqual ("x", r.Namespace.Prefix, "#12-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "#12-3");

			Assert.IsTrue (r.Read (), "#16");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#17");
			var xt = new XamlType (typeof (TestClass5), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "#17-2");
//			Assert.IsTrue (r.Instance is TestClass5, "#17-3");
			Assert.AreEqual (2, xt.GetAllMembers ().Count, "#17-4");
			Assert.IsTrue (xt.GetAllMembers ().Any (xm => xm.Name == "Bar"), "#17-5");
			Assert.IsTrue (xt.GetAllMembers ().Any (xm => xm.Name == "Baz"), "#17-6");

			if (r is XamlXmlReader)
				ReadBase (r);

			Assert.IsTrue (r.Read (), "#21");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#22");
			Assert.AreEqual (xt.GetMember ("Bar"), r.Member, "#22-2");

			Assert.IsTrue (r.Read (), "#26");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#27");
			Assert.AreEqual (XamlLanguage.Null, r.Type, "#27-2");
//			Assert.IsNull (r.Instance, "#27-3");

			Assert.IsTrue (r.Read (), "#31");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#32");

			Assert.IsTrue (r.Read (), "#36");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#37");
			// static Foo is not included in GetAllXembers() return value.
			// ReadOnly is not included in GetAllMembers() return value neither.
			// nonpublic Baz is a member, but does not appear in the reader.

			Assert.IsTrue (r.Read (), "#51");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#52");

			Assert.IsFalse (r.Read (), "#56");
			Assert.IsTrue (r.IsEof, "#57");
		}
开发者ID:imphasing,项目名称:mono,代码行数:49,代码来源:XamlReaderTestBase.cs

示例10: GetSomeMemberHasDependencies

 private static bool GetSomeMemberHasDependencies(XamlType xamlType)
 {
     var allMembers = xamlType.GetAllMembers().OfType<MutableXamlMember>();
     return allMembers.Any(member => member.Dependencies.Any());
 }
开发者ID:grokys,项目名称:OmniXAML,代码行数:5,代码来源:MemberDependencyNodeSorter.cs


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