MergeFrom() public method

Like MergeFrom(IMessage), but merges from another FieldSet.
public MergeFrom ( FieldSet other ) : void
other FieldSet
return void
 public override Builder MergeFrom(IMessage other)
 {
     if (other.DescriptorForType != type)
     {
         throw new ArgumentException("MergeFrom(IMessage) can only merge messages of the same type.");
     }
     fields.MergeFrom(other);
     MergeUnknownFields(other.UnknownFields);
     for (int i = 0; i < oneofCase.Length; i++)
     {
         if (other.HasOneof(type.Oneofs[i]))
         {
             if (oneofCase[i] == null)
             {
                 oneofCase[i] = other.OneofFieldDescriptor(type.Oneofs[i]);
             }
             else
             {
                 if (oneofCase[i] != other.OneofFieldDescriptor(type.Oneofs[i]))
                 {
                     fields.ClearField(oneofCase[i]);
                     oneofCase[i] = other.OneofFieldDescriptor(type.Oneofs[i]);
                 }
             }
         }
     }
     return(this);
 }
Esempio n. 2
0
 public override Builder MergeFrom(IMessage other)
 {
     if (other.DescriptorForType != type)
     {
         throw new ArgumentException("MergeFrom(IMessage) can only merge messages of the same type.");
     }
     fields.MergeFrom(other);
     MergeUnknownFields(other.UnknownFields);
     return(this);
 }