Questions tagged [out]

In c#, the out keyword causes parameters to be passed by reference from the callee to the caller. The parameter doesn't have to be assigned going into a function but must be assigned before coming out of the function.

The out keyword causes arguments to be passed by reference. This is similar to the ref keyword, except that ref requires that the variable be initialized before being passed. To use an out parameter, both the method definition and the calling method must explicitly use the out keyword. For example:

class OutExample
{
    static void Method(out int i)
    {
        i = 44;
    }
    static void Main()
    {
        int value = 2;
        Method(out value);
        // value is now 44
    }
}

Although variables passed as out arguments need not be initialized prior to being passed, the called method is required to assign a value before the method returns.

The ref and out keywords are treated differently at run-time, but they are treated the same at compile time. Therefore methods cannot be overloaded if one method takes a ref argument and the other takes an out argument.

598 questions
-1
votes
2 answers

Can't get outfile to read data from infile(c++)

Data in the input file: Wilson Jack 87236.45 11 My code: #include #include #include #include using namespace std; int main() { ofstream out; ifstream in; string Lastname, Firstname; double…
Ninjaboi
  • 3
  • 4
-1
votes
1 answer

SonarQube MySQL read time out

My system consists of: SonarQube 5.1, MySQL 5.6.19, Sonar-Qube Runner 2.4 I have a project with 20 submodules and 2,7 million lines of code. When I try to execute an analysis it randomly fails with the following error: ERROR: Caused by: Unable to…
Stelos10
  • 451
  • 2
  • 6
  • 15
-1
votes
1 answer

make disappear bottom line in tabs html jquery css

i am making a web application and trying to make some nice tabs. The thing is i can't make the tabs show its content when they are active (if tab1 show content1) but without the bottom-border of the tab, classic tabs. With this i mean by switching…
Agustin
  • 95
  • 2
  • 10
-1
votes
2 answers

ssh: connect to host 128.114.126.232 port 22: Connection timed out

I'm receiving this error when I attempt to ssh into the target remote host. I've attempted to shh in from two different computers to no avail. A solution I've found looking around was to redirect to a different port, but I receive this error again…
-1
votes
1 answer

Can't separate columns when reading txt file

Hi I managed to read txt files and printing them on the console window. I was given a task to select and sample a certain amount of data. Example of txt file: Voltage (V),Current (I),Power (W) 50,2,100, 51,2,102, 52,2,104, etc.. How can I display…
Bonavia
  • 55
  • 2
  • 5
-1
votes
1 answer

Java "exception in thread "main"" error fix

Currently I am working on a application which allows technical manuals to be added, stored, borrowed, returned to a virtual library. Currently I am working on the section which allows the user to return a book they have previously borrowed. When…
Oscar
  • 511
  • 2
  • 10
  • 25
-1
votes
3 answers

Is it Out can be used for passing a reference type (i.e) Objects?

Consider the following example, here int i is passed for the reference. My question is, Can i pass a reference type to out? like object (i.e) static void sum(out OutExample oe) class OutExample { static void Sum(out int i) { i = 5; …
Balaji
  • 1,375
  • 1
  • 16
  • 30
-1
votes
1 answer

Why is there difference between out.println and err.println?

System.class contains "out" and "err" object of Printstream class. System.class is declared static. println() is a overloaded method in Printstream class which have (out and err objects) if we execute System.out.println("Xys"); and…
-1
votes
1 answer

connection time out in firefox browsers

I have for loop which takes about 30 minutes.so when run the browser's time out.I change max execution time in php.INI but give the same error. I how I can do to change setting in Firefox?in order my script to run successfully.
shirima
  • 1
  • 1
  • 1
-1
votes
2 answers

How to call other class method with out parameter

Why can I not call another class's method with out parameter? For example: class Program { static void Main(string[] args) { int i =10; int j = OtherClass.Test(i); } } class OtherClass { public static int…
Moh Tarvirdi
  • 685
  • 1
  • 13
  • 25
-1
votes
1 answer

Print out entire array?

I want to print out an entire array like this in…
Matrix
  • 9
  • 5
-1
votes
4 answers

Get value of out parameter before assigning

I'm updating a method that contains an out parameter. I need to check the value of the parameter before setting it to a default. public int DoWork(out int param) { param = 0; } However, when I try to do something like this public int…
miguelarcilla
  • 1,426
  • 1
  • 20
  • 38
-1
votes
2 answers

Can not figure out how to break out of loop

I have a letter guessing game to complete in Python. The letters the user can pick are "a,b,c, and d." I know how to give them five tries, but when I guess one of the correct letters, I can't break out the loop and congratulate the player. g =…
-1
votes
2 answers

Keep values passed in from an 'out' parameter

We are running a program in a loop on an enterprise scheduler throughout the day. The scheduler needs an integer return value, so we have to write the program to naturally return this. However, we want to keep a running tally of some information so…
NealR
  • 10,189
  • 61
  • 159
  • 299
-1
votes
4 answers

the value to "out" parameter must be assigned in the method body, otherwise the method will not be compiled

I have the following code in c# class Sample{ public void sum(out int num1,int num2) { } public void print() { int i=12; sum(out i,10); Console.WriteLine(i); } } I have read that it works like 'ref',then why the following code give error saying…
dnyaneshwar
  • 1,296
  • 3
  • 18
  • 26