# Method parameter modifiers: out and ref

**URL:** <https://www.ruby-forum.com/t/method-parameter-modifiers-out-and-ref/177427>\
**Category:** IronRuby\
**Created:** [October 16, 2009, 10:23pm UTC](https://www.ruby-forum.com/t/method-parameter-modifiers-out-and-ref/177427 "2009-10-16T22:23:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Thompson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@James\_Thompson](https://www.ruby-forum.com/u/James_Thompson)\
**Post date:** [October 16, 2009, 10:23pm UTC](https://www.ruby-forum.com/t/method-parameter-modifiers-out-and-ref/177427/1 "2009-10-16T22:23:04Z")

</div>

I am trying to work with a .NET lib that uses ref modifiers on some  
method  
params and am not sure how to work with them from Ruby. I know with out  
modifiers that those parameters become part of the return values, but  
what  
can I do with ref parameters from Ruby?

James Thompson  
Plain Programs  
New Orleans, LA

P: (502) 619.0353  
E: removed\_email\_address@domain.invalid  
W: [www.plainprograms.com](http://www.plainprograms.com)

---

<div class="post-metadata">

**Author:** ![James\_Thompson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@James\_Thompson](https://www.ruby-forum.com/u/James_Thompson)\
**Post date:** [October 16, 2009, 10:39pm UTC](https://www.ruby-forum.com/t/method-parameter-modifiers-out-and-ref/177427/2 "2009-10-16T22:39:27Z")

</div>

They are just like out parameters that have input value as well.

public class C {  
public int foo(ref int bar) { bar++; return 3; }  
}

p C.new.foo(1) # =\> [3, 2]

Tomas

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of James Thompson  
Sent: Friday, October 16, 2009 1:14 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Method parameter modifiers: out and ref

I am trying to work with a .NET lib that uses ref modifiers on some  
method params and am not sure how to work with them from Ruby. I know  
with out modifiers that those parameters become part of the return  
values, but what can I do with ref parameters from Ruby?

James Thompson  
Plain Programs  
New Orleans, LA

P: (502) 619.0353  
E: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
W: [www.plainprograms.com](http://www.plainprograms.com)[http://www.plainprograms.com](http://www.plainprograms.com)

---

<div class="post-metadata">

**Author:** ![James\_Thompson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@James\_Thompson](https://www.ruby-forum.com/u/James_Thompson)\
**Post date:** [October 16, 2009, 10:40pm UTC](https://www.ruby-forum.com/t/method-parameter-modifiers-out-and-ref/177427/3 "2009-10-16T22:40:02Z")

</div>

## look here: [http://rubyforge.org/pipermail/ironruby-core/2009-June/004731.html](http://rubyforge.org/pipermail/ironruby-core/2009-June/004731.html)

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))
