# Is there a way to get Haxe to keep real types in Array type parameters?

**URL:** <https://community.haxe.org/t/is-there-a-way-to-get-haxe-to-keep-real-types-in-array-type-parameters/2253>\
**Category:** Haxe\
**Tags:** haxe-cs\
**Created:** [February 1, 2020, 12:07am UTC](https://community.haxe.org/t/is-there-a-way-to-get-haxe-to-keep-real-types-in-array-type-parameters/2253 "2020-02-01T00:07:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![theJenix](https://community.haxe.org/user_avatar/community.haxe.org/thejenix/32/1138_2.png) [@theJenix](https://community.haxe.org/u/theJenix)\
**Post date:** [February 1, 2020, 12:07am UTC](https://community.haxe.org/t/is-there-a-way-to-get-haxe-to-keep-real-types-in-array-type-parameters/2253/1 "2020-02-01T00:07:12Z")

</div>

I am noticing that in my generated C# code, `Array<RealType>` is always replaced with `Array<object>`; this is particularly an issue when extern classes, where I want to use the specific types, e.g. `Array<RealType>` but have to accept `Array<object>` to satisfy the C# compiler. Is there a way to tell haxe or hxcs to use the real types?

---

<div class="post-metadata">

**Author:** ![RealyUniqueName](https://community.haxe.org/user_avatar/community.haxe.org/realyuniquename/32/10_2.png) [@RealyUniqueName](https://community.haxe.org/u/RealyUniqueName)\
**Post date:** [February 1, 2020, 4:50am UTC](https://community.haxe.org/t/is-there-a-way-to-get-haxe-to-keep-real-types-in-array-type-parameters/2253/2 "2020-02-01T04:50:22Z")

</div>

I don’t know any way to do that for `Array`.  
For your own custom classes it’s usually possible by using `@:nativeGen` meta.  
As a workaround, you can pass native arrays to/from externs:

```haxe
var nativeArray = cs.Lib.nativeArray(haxeArray, true);

```

AFAIK type parameters for extern types don’t get replaced with `object`, and `cs.NativeArray` is an extern type.
