Bamboo.Prevalence.Serialization.AutoVersionMigrationSurrogate.FindField C# (CSharp) Method

FindField() private method

private FindField ( Type t, string name ) : FieldInfo
t System.Type
name string
return System.Reflection.FieldInfo
		private FieldInfo FindField(Type t, string name)
		{
		  /* Rutger M. Dijkstra ([email protected])
		   * Search for the field in t or its ancestors. Having adopted
		   * the same naming strategy as standard serialization, data
		   * that has been serialized with auto version-migration 'off'
		   * will deserialize error-free if we turn auto version-migration 'on'.
		   */
		  int plus = name.IndexOf('+');
		  if (0 <= plus)
		  {
			  //name is qualified with an ancestor class
			  string className = name.Substring(0, plus);
			  name = name.Substring(plus+1);
			  do
			  {
				  //scan upward for the correct ancestor type
				  t = t.BaseType;
			  }
			  while(t != null && t.Name != className);
		  }
		  if (t == null)
		  {
			  return null; // vanished? renamed?
		  }
		  MemberInfo[] members = t.GetMember(name, MemberTypes.Field, BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance);
		  if (0 == members.Length)
		  {
			  return null; //vanished? moved?
		  }
		  return (FieldInfo)members[0];
		}