# RubyCLR - passing in a parameter of UInt16

**URL:** <https://www.ruby-forum.com/t/rubyclr-passing-in-a-parameter-of-uint16/82020>\
**Category:** Ruby\
**Created:** [January 16, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/rubyclr-passing-in-a-parameter-of-uint16/82020 "2007-01-16T22:20:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvanderw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@bvanderw](https://www.ruby-forum.com/u/bvanderw)\
**Post date:** [January 16, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/rubyclr-passing-in-a-parameter-of-uint16/82020/1 "2007-01-16T22:20:37Z")

</div>

I am trying to use RubyCLR to access an existing .NET assembly. When I  
try to call a method that takes a UInt16 (a C# ushort) parameter, I get  
a missing\_method error, presumably from RubyCLR, because it can’t match  
the parameter signature. (FWIW, this particular method is overloaded.)

I’ve tried everything I know to try to work around this, but I am  
stumped. How can I explicitly force a parameter of UInt16 (or Byte,  
etc.)??

–Bruce

---

<div class="post-metadata">

**Author:** ![bvanderw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@bvanderw](https://www.ruby-forum.com/u/bvanderw)\
**Post date:** [January 16, 2007, 11:12pm UTC](https://www.ruby-forum.com/t/rubyclr-passing-in-a-parameter-of-uint16/82020/2 "2007-01-16T23:12:57Z")

</div>

On 1/16/07, bvanderw [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve tried everything I know to try to work around this, but I am  
> stumped. How can I explicitly force a parameter of UInt16 (or Byte,  
> etc.)??

It’s a bit of a hack, but I’d just use the System.Convert method that  
.NET already provides. You should be able to call it from Ruby and  
pass the value returned to your assembly.

Justin

---

<div class="post-metadata">

**Author:** ![bvanderw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@bvanderw](https://www.ruby-forum.com/u/bvanderw)\
**Post date:** [January 17, 2007, 3:05am UTC](https://www.ruby-forum.com/t/rubyclr-passing-in-a-parameter-of-uint16/82020/3 "2007-01-17T03:05:32Z")

</div>

Justin - that’s one of the things I tried, and it doesn’t appear to  
work. Thanks anyway!
