473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

returning more than one value....in .NET(C#).

Hi all,

How can we catch the return values if the function, which takes out parameters, is going to return more than one value in C#.

Ex: public int addparams(out int x,out int y)
{
Int someinteger;

//code

return someinteger ;
}
Requesting you all kindly plz find some time and tell me, Is this method returns more than one value,if so how can catch that return values.

Thanks in advance..

regards,
tirumala.
Sep 24 '07 #1
5 2341
hbxtlhx
10
Hi all,

How can we catch the return values if the function, which takes out parameters, is going to return more than one value in C#.

Ex: public int addparams(out int x,out int y)
{
Int someinteger;

//code

return someinteger ;
}
Requesting you all kindly plz find some time and tell me, Is this method returns more than one value,if so how can catch that return values.

Thanks in advance..

regards,
tirumala.
return struct or class.
example:

struct A
{
public int a;
public int b;
public int c;
}
public A addparams(out int x,out int y)
{
Int someinteger;

//code
A a=new A();
a.a=1;
a.b=2;
a.c=3;
return a;
}
Sep 24 '07 #2
r035198x
13,262 8TB
Hi all,

How can we catch the return values if the function, which takes out parameters, is going to return more than one value in C#.

Ex: public int addparams(out int x,out int y)
{
Int someinteger;

//code

return someinteger ;
}
Requesting you all kindly plz find some time and tell me, Is this method returns more than one value,if so how can catch that return values.

Thanks in advance..

regards,
tirumala.
I suppose you do have a C# textbook with you right?
What does it say about that. If it doesn't have that topic in it then shame on the author and shame on the teacher who recommended it.
Sep 24 '07 #3
r035198x
13,262 8TB
return struct or class.
example:

struct A
{
public int a;
public int b;
public int c;
}
public A addparams(out int x,out int y)
{
Int someinteger;

//code
A a=new A();
a.a=1;
a.b=2;
a.c=3;
return a;
}
So why use out parameters then?
Sep 24 '07 #4
hbxtlhx
10
int xvar=0;
int yvar=0;
int retvar=0;

retvar = addparams(out xvar,out yvar);

Console.WriteLine(xvar);
Console.WriteLine(yvar);
Console.WriteLine(retvar);
Sep 24 '07 #5
r035198x
13,262 8TB
int xvar=0;
int yvar=0;
int retvar=0;

retvar = addparams(out xvar,out yvar);

Console.WriteLine(xvar);
Console.WriteLine(yvar);
Console.WriteLine(retvar);
1.) Please use code tags if you have to post code.
2.) I'm not sure what you're trying to achieve with this code but if you're referring to the OP's question then the best thing is simply to read about these things like I've already said.
Sep 24 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mountain Man | last post by:
Hi, I'm having trouble with the foreach function. I'm using it twice inside a user defined function with two different arrays, and in the second instance it's returning the value of the first...
9
by: mjm | last post by:
Folks, Stroustrup indicates that returning by value can be faster than returning by reference but gives no details as to the size of the returned object up to which this holds. My question is...
25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
13
by: Matthias Kaeppler | last post by:
Hi, I was wondering why library implementors often make getter functions return strings by value (copies). For example, in boost::filesystem the leaf() function returns an std::string by value....
4
by: jt | last post by:
I'm getting a compiler error: warning C4172: returning address of local variable or temporary Here is the function that I have giving this error: I'm returning a temporary char string and its...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
8
by: sam | last post by:
i am starting to experiment with recursion, and decided to write a fairly trivial little program which took a float as input, then called a function to halve it recursively until it was less than...
3
by: yanksRoll | last post by:
Hi, I'm having a problem with the following trigger: CREATE TRIGGER tr_FamID ON dbo.myFirstTbl FOR INSERT AS DECLARE @address2 VARCHAR (50) DECLARE @compareFamID INT
23
by: pauldepstein | last post by:
Below is posted from a link for Stanford students in computer science. QUOTE BEGINS HERE Because of the risk of misuse, some experts recommend never returning a reference from a function or...
160
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.