Fastest way to write values to a discontinuous or non-contiguous range in .NET

I was wondering if had any suggestions for the fastest way to write values to discontiguous cells.

I know you can write to a single range really fast using a 2D array for objects (e.g. ($A$1:$B$20)

                var range = cells.CreateRange(0, 0,
                    20, 2);

                range.Value = new object[,].....

My question is, how to write to a discontiguous range quickly all in one go? Something like:
$A$1:$B$20,$D$5:$E$11,$E$18:$F$21
Do I have to loop through each range in the area and set those individually?

Thanks!
Dean

@Moonglum,

Aspose.Cells supports union of ranges option which you may try to use to write value(s) into the relevant cells in one go for discontinuous ranges. See the following sample code for your reference:
e.g.
Sample code:

Workbook workbook = new Workbook();
UnionRange r = workbook.Worksheets.CreateUnionRange("$A$1:$B$20,$D$5:$E$11,$E$18:$F$21", 0);
            r.Value = "ABCD";
            Style style = workbook.CreateStyle();
            style.Pattern = BackgroundType.Solid;
            style.ForegroundColor = System.Drawing.Color.Red;
            r.ApplyStyle(style, new StyleFlag() { CellShading = true });
            workbook.Save("e:\\test2\\out1.xlsx");

Hope, this helps a bit.

Awesome, just what I was looking for.
Thank you very much!

@Moonglum,

Good to know that the suggested code segment works for your needs. In the event of further queries or issue, feel free to write us back.