Exemplo n.º 1
0
		static string[] DescribeFields(FieldInfo[] fi)
		{
			string[] result = null;
			string mods;
			FieldInfo f;
			result = new string[fi.Count()];

			for (int i = 0; i < fi.Count(); i++)
			{
				f = fi[i];
				mods = "";

				if (f.IsPublic)
				{
					mods = mods + "public ";
				}

				if (f.IsPrivate)
				{
					mods = mods + "private ";
				}

				if (f.IsFamily)
				{
					mods = mods + "protected ";
				}

				if (f.IsLiteral)
				{
					mods = mods + "const ";
				}
				else if (f.IsStatic)
				{
					mods = mods + "static ";
				}

				if (f.IsInitOnly)
				{
					mods = mods + "readonly ";
				}

				result[i] = string.Format("{0} {1};", f.FieldType, f.Name);
				result[i] = mods + result[i];
			}

			return result;
		}
Exemplo n.º 2
0
 private static void VerifyFieldsEquality(FieldInfo[] fieldInfo1, FieldInfo[] fieldInfo2)
 {
     if (TestHelper.AreNotNull(fieldInfo1, fieldInfo2))
     {
         Assert.AreEqual(fieldInfo1.Count(), fieldInfo2.Count());
         foreach (FieldInfo field1 in fieldInfo1)
         {
             FieldInfo field2 = fieldInfo2.First(f => f.Name == field1.Name);
             Assert.IsTrue(AreTypesEqual(field2.FieldType, field1.FieldType));
         }
     }
 }