0

Is it possible to assign a list or array to IRowBuffer Row?

I have something like the following: I have a fields (list) with values and i have to fill a Row with that values.

public void fillRow(IRowBuffer Row)
 {
  for (int i=0;i < fields.length;i++)
    {
      Row.set_Value(i, fields[i].toString()
    }
 }

Is there no way where i can just assign the fields to Row, without looping. What if my fields has like 500 elements and i have to loop 100x500? I know that Row has 2 requiredFields (ID, SHAPE)

4
  • If there was a method that accepted the array wouldn't ArcObjects just be running the same loop under the covers anyway? If I was you I wouldn't worry about how the values are set but about the 1,000 other things that can go wrong in an ArcObjects tool
    – tomfumb
    Commented Aug 30, 2012 at 19:05
  • Do you mean you want to see how to use a list of field indices? That way you can avoid getting an exception on row.set_value(0,"") since the OID is usually in that position, and is not editable. (IField.Editable is false). Commented Aug 30, 2012 at 19:23
  • @KirkKuykendall Hmm, i wanted something like this Row = fields[i]. the i-element would be an array or list. But i have to set every column and row individually?
    – Gero
    Commented Aug 30, 2012 at 20:48
  • If the field is a Blob, and the list you are assigning to it is serializable, I suppose you could do it via IMemoryBlobStream. However, you still need to call set_Value for each field you want to populate AFAIK. Commented Aug 30, 2012 at 21:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.