Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2004, 09:44 AM
Registered User
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Return Statement

In C# when using the return statement
is it possible to return two vaules.

CodeMonkeys
 
Old August 17th, 2004, 10:51 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Methods return only 1 value.

However, that value could can anything, like an object. So you could return a billion values in a object that can hold them.
 
Old August 22nd, 2004, 10:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

there is only 1 return in all C base lang!

Always:),
Hovik Melkomian.
 
Old August 23rd, 2004, 06:07 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

as hovik told you everything you named it function returns only one value but if you want to return more values you should send them as refrence parameters.
refrence parameter is a special parameter could change within your function(method).

--------------------------------------------
Mehdi.:)
 
Old August 25th, 2004, 11:33 AM
Authorized User
 
Join Date: Jul 2004
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post
Default

you could do that like :

bool function FooBar(ref string Param)
{
  Param = "Test";
  return true;
}

Now whatever string you pass in for Param will equal Test. You can also use "out" variables as well.

www.CoderForRent.com
Get A Computer Job!





Similar Threads
Thread Thread Starter Forum Replies Last Post
SELECT statement nullifying RETURN value Bob Bedell ADO.NET 2 January 18th, 2008 09:17 PM
need some help please getting a return value merk ASP.NET 2.0 Basics 4 October 3rd, 2007 07:10 PM
Return all or nothing SQL Statement help... brux2dc SQL Language 1 May 30th, 2007 03:44 AM
How to return an array ? arulkumar ASP.NET 2.0 Professional 0 March 3rd, 2007 03:15 PM
return to value in <SELECT> statement mikeuk Beginning PHP 3 September 25th, 2004 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.