# Passing 'type' as a parameter.

**URL:** <https://forum.xojo.com/t/passing-type-as-a-parameter/48225>\
**Category:** General\
**Created:** [April 20, 2019, 7:09pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225 "2019-04-20T19:09:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/brian_o_brien/32/20096_2.png) [@Brian\_O\_Brien](https://forum.xojo.com/u/Brian_O_Brien)\
**Post date:** [April 20, 2019, 7:09pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/1 "2019-04-20T19:09:25Z")

</div>

I have a method that reads raw data files that contain either 16 bit unsigned integers or 32 bit singles.  
(These end up in a memory block)

I want to pass the type of data to a method of my class. but how do you pass UInt16 or Single as parameter?

I could define enumerated data types for each type that Memory block is aware of, but that seems somehow redundant.

Is there perhaps a way using the variant type?

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [April 20, 2019, 7:42pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/2 "2019-04-20T19:42:32Z")

</div>

create a series of overload methods?

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [April 20, 2019, 7:45pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/3 "2019-04-20T19:45:39Z")

</div>

Pass Introspection TypeInfo? (Through the Xojo framework.)

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [April 20, 2019, 11:47pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/4 "2019-04-20T23:47:53Z")

</div>

Thats how I created the Type Dictionary on my web site [http://great-white-software.com/gws-rb-samples/TypedDict.zip](http://great-white-software.com/gws-rb-samples/TypedDict.zip)  
It gives you a dictionary that is type enforced for keys & values

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [April 21, 2019, 10:51am UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/5 "2019-04-21T10:51:30Z")

</div>

> [@433331:@Kem Tekinay](#):
>
> Pass Introspection TypeInfo? (Through the Xojo framework.)

Curious, why do you recommend the new classes over the classic ones?

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [April 21, 2019, 12:08pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/6 "2019-04-21T12:08:45Z")

</div>

Unless there has been some change, you can’t get the TypeInfo on an intrinsic type with Classic.

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [April 21, 2019, 2:38pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/7 "2019-04-21T14:38:42Z")

</div>

Dont use classic 😛  
There are some things the new framework does better - this is one

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [April 21, 2019, 3:21pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/8 "2019-04-21T15:21:04Z")

</div>

They really need to step up the pace to add whatever is better in New to classic. Since now we have even more confusion than before with the new framework getting told that will not be the future plan of things.

I did not mind the new framework but the new vs classic is a thing that has to end one way or another. If the choice is classic then fix it how you want it and let the new die.

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [April 21, 2019, 3:53pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/9 "2019-04-21T15:53:49Z")

</div>

> [@433399:@Björn Eiríksson](#):
>
> If the choice is classic then fix it how you want it and let the new die.

You mean me ?  
I don’t work there any more so I cant do anything about this  
Based on previously discussed goals I expect that [API 2.0](https://www.bkeeneybriefs.com/2018/04/xdc-2018-android-xojo-framework-and-api-2-0-notes/) will be this consolidation

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [April 21, 2019, 4:12pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/10 "2019-04-21T16:12:35Z")

</div>

No not you 🙂 I meant Xojo !

I know your no longer there so was in no way shooting at you.

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [April 21, 2019, 4:35pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/11 "2019-04-21T16:35:50Z")

</div>

Watch XDC live blogs for any more details from the API 2.0 session  
[https://www.xojo.com/xdc/sessions/info/hill/](https://www.xojo.com/xdc/sessions/info/hill/)

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:37pm UTC](https://forum.xojo.com/t/passing-type-as-a-parameter/48225/12 "2020-10-29T19:37:35Z")

</div>


