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
-2
votes
1 answer

Divs move around when i zoom in/out

My webpage layout is changing when i zoom in and out on google chrome! Here is the link to my website: http://party.mccrossings.net I did already check other posts which did not help me out!
Sam Younes
  • 11
  • 2
-2
votes
3 answers

Ref and Out Parameters Questions

I thought I understood the difference, but now I'm not so sure. I've read the technical answer several times but I'm not understanding what is happening. I have this example. class Program { static void Main() { int val =…
christopher clark
  • 2,026
  • 5
  • 28
  • 47
-2
votes
1 answer

When to use ref and out?

So I'm working on a really simple lab for my college class and have run into a bit of a problem. My teacher failed to thoroughly explain when you would use ref and when to use out. The assignment was change a pre-written method to use ref, then make…
Brandon
  • 281
  • 2
  • 17
-2
votes
1 answer

Python code - List index out of range?

For an assigment, we have to do a travelling salesman sort of code using geolocator code from a list of cities that is not given to us, assuming the first city in the list is the starting/ending city. My code is incomplete, but barely, as I think…
Wakeen
  • 3
  • 2
-2
votes
3 answers

Proper usage of out parameter in C#

Edit: I know this is typically not done, and is on the lines of bad practice, but my hand is sort of forced in this specific usage case. My other alternative (as I see it fro this case) is to route an event through my singleton (not shown) and…
Nyra
  • 859
  • 1
  • 7
  • 27
-2
votes
1 answer

Only Getting 0s for an output on Array Assignment

I have an assignment and I need to write the code for this problem. Write a program that reads numbers from the keyboard into an array of type int[] You may assume there will be 50 or fewer entries. Your program allows any amount of numbers to be…
Conrad
  • 1
  • 2
-2
votes
1 answer

(Python) Why is this index out of range?

The following code is what I have written to read data from a website and store it in a list. The code works, but it also throws a list out of range error regardless. Can anybody explain what I'm doing wrong? import urllib.request data_url =…
KillianO93
  • 19
  • 1
  • 5
-2
votes
5 answers

C# "as" operator and advanced conversion use in loops/functions and out/ref parameters modifiers and typeof()

I Need some clarifications about: is/as operators out/ref parameters modifiers typeof Feel free to reply only to what you know or what you want to reply and not the whole question if you don't feel like. Yes, I'm asking clarifications about these.…
Liquid Core
  • 1
  • 6
  • 27
  • 52
-2
votes
1 answer

How to copy a .out file to postgresql?

I have this file (warning: potentially unsafe file download site) that I need to insert into the database using Postgres and Java. Please download it and let me know how I can extract data from this file. I tried the copy command. For one, it did…
CodingInCircles
  • 2,565
  • 11
  • 59
  • 84
-2
votes
1 answer

randomize char output to text file

I am pretty new to programming in C++, I want to display How to display produce a output.txt file in this format. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z T W G X Z R L L N H A I A F L E W G Q H V R N V D U in…
newbieprogrammer
  • 848
  • 7
  • 23
  • 46
-3
votes
1 answer

Can anyone help me to understand why i have the error "list index out of range"?

I'm facing an issue trying to sum all the elements of a list in python without using the sum() function. So, the thing is, when i run my code i'm able to get the desired result, but below appears this error IndexError: list index out of range This…
SHerbes
  • 1
  • 1
-3
votes
1 answer

How to break out of a promise (.then) statement javascript

I'm having a problem trying to break out of a promise statement when an error occurs in a catch statement. I'm not sure if I can throw an error inside a catch statement. The problem: The catch function isn't doing anything when I throw an…
-3
votes
1 answer

How to combine multiple .out files to a single file in Windows environment?

I was given hundreds of files in .out format. I appreciate if you can help me find a way to combine them all in one file. I have no Linux knowledge and will prefer to work it out with Python
Milad
  • 29
  • 5
-3
votes
1 answer

ArrayList IndexOutOfBoundsException JAVA

When I try to run the program I have those error, Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at…
Ayala10
  • 17
  • 5
-3
votes
3 answers

Two Same variable declared in C#

I found a code online which i'm using in my Program, but to my surprise i found out there was a variable/function declared twice... Now, If i'm to send any value to the DLL, which of the two would i send info to? One use out, while the second does…
ThisDude
  • 111
  • 2
  • 9
1 2 3
39
40