From 4326da9ab3f923ea8bbbeebebefd5bdda272721b Mon Sep 17 00:00:00 2001 From: Quentin Date: Thu, 19 Oct 2017 09:45:57 +0200 Subject: [PATCH] [C#] Add ToArray to std_vector.i --- Lib/csharp/std_vector.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index 0d1476f7f..95543c2fa 100644 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -114,6 +114,12 @@ array.SetValue(getitemcopy(index+i), arrayIndex+i); } + public $typemap(cstype, CTYPE)[] ToArray() { + $typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[Count]; + this.CopyTo(array); + return array; + } + global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() { return new $csclassnameEnumerator(this); }