internal ClassDefinitionBuilder AddField(FieldDefinition fieldDefinition)
 {
     Check();
     if (index != fieldDefinition.GetIndex())
     {
         throw new ArgumentException("Invalid field index");
     }
     index++;
     fieldDefinitions.Add(fieldDefinition);
     return this;
 }
 internal virtual void AddFieldDef(FieldDefinition fd)
 {
     _fieldDefinitionsMap[fd.GetName()] = fd;
 }
 protected bool Equals(FieldDefinition other)
 {
     return classId == other.classId && factoryId == other.factoryId && string.Equals(fieldName, other.fieldName) && index == other.index && type == other.type;
 }
 public virtual void TestFieldDef_getter_setter()
 {
     var field0 = classDefinition.GetField(0);
     var field = classDefinition.GetField("f1");
     var fd = new FieldDefinition(9, "name", FieldType.Portable, 5, 6);
     var fd_nullName = new FieldDefinition(10, null, FieldType.Portable, 15, 16);
     Assert.AreEqual(field, field0);
     Assert.AreEqual(0, field.GetFactoryId());
     Assert.AreEqual(0, field.GetClassId());
     Assert.AreEqual(0, field.GetIndex());
     Assert.AreEqual("f1", field.GetName());
     Assert.AreEqual(FieldType.Byte, field.GetFieldType());
     Assert.AreEqual(5, fd.GetFactoryId());
     Assert.AreEqual(6, fd.GetClassId());
     Assert.AreEqual(9, fd.GetIndex());
     Assert.AreEqual("name", fd.GetName());
     Assert.AreEqual(FieldType.Portable, fd.GetFieldType());
     Assert.AreEqual(15, fd_nullName.GetFactoryId());
     Assert.AreEqual(16, fd_nullName.GetClassId());
     Assert.AreEqual(10, fd_nullName.GetIndex());
     Assert.AreEqual(null, fd_nullName.GetName());
     Assert.AreEqual(FieldType.Portable, fd_nullName.GetFieldType());
 }
 public virtual void TestFieldDef_equal_hashCode()
 {
     var fd0 = new FieldDefinition(0, "name", FieldType.Boolean);
     var fd0_1 = new FieldDefinition(0, "name", FieldType.Int);
     var fd1 = new FieldDefinition(1, "name", FieldType.Boolean);
     var fd2 = new FieldDefinition(0, "namex", FieldType.Boolean);
     Assert.AreNotEqual(fd0, fd0_1);
     Assert.AreNotEqual(fd0, fd1);
     Assert.AreNotEqual(fd0, fd2);
     Assert.AreNotEqual(fd0, null);
     Assert.AreNotEqual(fd0, "Another Class");
     Assert.AreNotEqual(0, fd0.GetHashCode());
 }
 internal virtual void AddFieldDef(FieldDefinition fd)
 {
     fieldDefinitionsMap[fd.GetName()] = fd;
 }
 protected bool Equals(FieldDefinition other)
 {
     return _classId == other._classId && _factoryId == other._factoryId &&
            string.Equals(_fieldName, other._fieldName) &&
            _index == other._index && _type == other._type;
 }