diff --git a/bindings/csharp/IOBuffer.cs b/bindings/csharp/IOBuffer.cs index 1697f6ef4..a64d00a8c 100644 --- a/bindings/csharp/IOBuffer.cs +++ b/bindings/csharp/IOBuffer.cs @@ -134,10 +134,10 @@ private void Dispose(bool clean) /// The number of samples written will not exceed the size of the buffer. public void fill(byte[] array) { - int length = (int) iio_buffer_end(buf) - (int) iio_buffer_start(buf); + long length = (long) iio_buffer_end(buf) - (long) iio_buffer_start(buf); if (length > array.Length) length = array.Length; - Marshal.Copy(array, 0, iio_buffer_start(buf), length); + Marshal.Copy(array, 0, iio_buffer_start(buf), (int)length); } } }