What are various ways to pass parameters in C#?

  • Thread starter Thread starter Anonieko Ramos
  • Start date Start date
A

Anonieko Ramos

Parameters are passes by values by default

+----------+---------------+-----------------------+--------------------------+
| Type | Example | Passed by Value | Passed by Reference |
| | |(value parameter) | (reference parameter) |
+----------+---------------+-----------------------+--------------------------+
|Reference | StringBuilder | foo(StringBuilder sb) | foo(ref StringBuilder sb)|
|Type | | | |
+----------+---------------+-----------------------+--------------------------+
|Value | Integer | foo(Integer x) | foo(ref Integer x) |
|Type | | | |
+----------+---------------+-----------------------+--------------------------+
 
Hi ,

Take a look at Jon's page, it has a good explanation of that.
http://www.yoda.arachsys.com/csharp/parameters.html

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Anonieko Ramos said:
Parameters are passes by values by default

+----------+---------------+-----------------------+------------------------
--+
| Type | Example | Passed by Value | Passed by Reference |
| | |(value parameter) | (reference parameter) |
+----------+---------------+-----------------------+------------------------
--+
|Reference | StringBuilder | foo(StringBuilder sb) | foo(ref StringBuilder sb)|
|Type | | | |
+----------+---------------+-----------------------+------------------------
--+
|Value | Integer | foo(Integer x) | foo(ref Integer x) |
|Type | | | |
+----------+---------------+-----------------------+------------------------
--+
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top