How can we return more than one value from C# function?

Welcome back at our first serial of step2 series of articles. This topic today will focus on how to return more than one value from our C# function. Also we will see the difference between ref and out keywords.

As we know, Function returns only one value. If we wanted to return more than one value, can we do so?

We can do so by 3 ways:

1- Ref keyword.

2- Out keyword.

3- Using Struct.

Lets see together our example.

03

04

05

06

07

08

09

10

11

12

13

14

15

I hope you find this first article at out step2 series to be useful.

See you soon inshaallah

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s