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.
5 2341
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;
}
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.
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?
int xvar=0;
int yvar=0;
int retvar=0;
retvar = addparams(out xvar,out yvar);
Console.WriteLine(xvar);
Console.WriteLine(yvar);
Console.WriteLine(retvar);
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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....
|
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...
|
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:
...
|
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...
|
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
|
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...
|
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;
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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...
|
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...
|
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,...
|
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,...
|
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...
| |