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

Stored routine out parameter stub

I have a mysql 5.5 stored routine: PROCEDURE get_stuff(IN po_id BIGINT, OUT po_name VARCHAR(32), OUT po_value VARCHAR(32)) ... I want call this procedure from other routine, but I dont need all out parameters of previous routine: PROCEDURE…
2dy
  • 129
  • 1
  • 1
  • 8
0
votes
1 answer

Kick out issue in Application

Ours is an application that has already been to production. We have maintenance and enhancements for the same application. When our QA onsite team was testing the application (several logins in the same application at a time), they faced kick out…
sjs
  • 45
  • 1
  • 8
0
votes
1 answer

COM method reading from output variable?

I'm calling a method in a for-loop that calls a method on a COM object (Inventor 2012). The code used to be: foreach (var occ in occurrences) { // [...] SomeMethod(occ); // [...] When refactoring I decided to inline the method…
johv
  • 4,424
  • 3
  • 26
  • 42
0
votes
1 answer

iOS simulator - trick to using TV Out?

I'm using the iOS simulator from xcode 4.3.1, and the "TV Out" option doesn't seem to be doing its thing. I've tried it with a variety of simulated devices and tv resolutions, but always just get a black screen. Perhaps it doesn't support the…
orion elenzil
  • 4,484
  • 3
  • 37
  • 49
0
votes
2 answers

Passing parameter array objects as out

How do I require that all of the objects in a parameter array be passed as out? In my following code, I know that it's failing because my original parameters never get assigned and are thus null. Even though I would think they'd be passed as…
Cowman
  • 678
  • 7
  • 25
0
votes
1 answer

Return Multiple Values from Function and Populating Variables (2) in the Caller

I have a function in class A: public int RecordSummary() { int result = 0; int recordsAffected = 0; SqlCommand cmd = new SqlCommand("spIATRecordSummary", conn); cmd.CommandType =…
JJ.
  • 9,580
  • 37
  • 116
  • 189
0
votes
1 answer

exception in thread main java.lang.StringIndexOutOfBoundsException: String index out of range: 6

so i am trying to wright a program to Print a word with all of the vowels replaced with $. in java. i keep getting this error exception in thread main java.lang.StringIndexOutOfBoundsException: String index out of range: 6 when i run it, it compiles…
user1560400
  • 3
  • 1
  • 1
  • 4
0
votes
6 answers

How to use 'using' with 'out' parameter

I have a method like so private bool VerbMethod(string httpVerb, string methodName, string url, string command, string guid, out HttpWebResponse response) I use this like this HttpWebResponse response; if (VerbMethod("POST", "TheMethod",…
CracyD
  • 368
  • 4
  • 16
0
votes
2 answers

Correct stream for interactive in perl

My perl script needs to ask the user for a password to download some files: print "Your password please: \n"; ReadMode('noecho'); $password = ReadLine(0); $password =~ s/\n//; ReadMode(0); system("wget --user=user --password=\"$password\"…
d135-1r43
  • 2,485
  • 1
  • 25
  • 33
0
votes
1 answer

How can I explore an out cursor parameter in a PLSQL block?

I need to verify a procedure that has an out cursor parameter. Specifically I need to see what is retrieving. I try this: declare type cursor_out is ref cursor; cur cursor_out; fila activ_economica%rowtype; procedure test(algo out…
mjsr
  • 7,410
  • 18
  • 57
  • 83
0
votes
2 answers

log4j - logging System.out and System.err concurrently to the console

We have a java webapp which schedules and runs several other tools in variety of languages /java, perl, bash, python etc.../ and 'eats' their out/err streams using StreamGobblers for troubleshooting purposes; Is it possible to use log4j /in a core…
John Stadt
  • 500
  • 7
  • 17
0
votes
5 answers

Java: String index out of range: -1

New code: I have no idea what's going on here, I'm getting this error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1949) at…
gossfunkel
  • 257
  • 2
  • 4
  • 13
0
votes
3 answers

Why would you create a Try method + out vs checking for some default (i.e. NULL)

The following is C#, though the code pattern is probably relevant to any OO language. I have two methods, MethodWithTry and MethodWithSomeReturnValue that I believe are functionally equivalent. I would like to know if one of them is the "correct"…
John
  • 3,332
  • 5
  • 33
  • 55
0
votes
2 answers

Linux server runs out of java memory

Looking for a solution or some tips on how to figure out what is wrong. Looking at heapdumps with VisualVM tool which just shows references are being held. Is there a better tool I can use? Is there anything I can run from the command line to…
user1356863
  • 143
  • 3
  • 12
0
votes
1 answer

re: fbml phase out

I have apps in fbml just received an email saying they will no longer work on june 1 what do i do? they say I have to create new apps in html surely there is another easier way to transition the apps any help/advice is appreciated on the best way to…