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

Cannot get the return values of stored procedure mysql

I want to get the out parameter of stored procedure using Zend framework Here's the procedure DELIMITER // CREATE procedure getAllUsers( out sysUsers VarChar(50) ) BEGIN DECLARE usersCursor CURSOR FOR SELECT username FROM SYSTEM_USERS; OPEN…
palAlaa
  • 9,500
  • 33
  • 107
  • 166
-1
votes
1 answer

writing binary tree in a txt file preorderly

I have a function that writes things from a binary tree. When I run it, it just writes the root of the tree in the txt. can someone tell me what is wrong here? void tree::wrte(person *p) { ofstream out("myfile.txt"); struct register{ …
Who Cares
  • 205
  • 5
  • 18
-1
votes
1 answer

C++/CLI calling Interop wrapper methods with out parameters

I've got an Interop wrapper to some unmanaged DLL calls that return details through out paremeters. The functions appear like this: _myWrapper->My_Method( ... out UInt32 value ... ); So assuming the method is declared like this: void My_Method(out…
Michael
  • 57
  • 1
  • 7
-1
votes
1 answer

How to get value in the current method from external void async method in C#?

I have method e.g. public async Task AddUser() { //some logic await _externalClass.DoSomething(); //some logic } And I want to get value from method await _externalClass.DoSomething(); (return type is Task and return type cannot be…
dimitri
  • 109
  • 6
-1
votes
1 answer

Filtering out by multiple criteria in R

I'm trying to create a separate df in R by filtering out observations based on specific criteria, but when using filter function from diplyr I only manage to create a df based on that criteria. Can any body guide me on the right direction test <-…
learnct
  • 13
  • 2
-1
votes
3 answers

Getting an error "string index out of range" in python

I was creating a code to encode an input word.Letters in the input text is converted to a number and stored in a list.Here is the code I used, z=input("input the word:") x= z.strip() y= -1 g=[ ] while y<=len(x): y=y+1 if x[y]==" ": …
user17328377
-1
votes
1 answer

Python\\ How to find out duplicate elements in 3 files

I have 3 files and I need to find out duplicate elements that appear in different files twice at-least.
Younes
  • 3
  • 1
-1
votes
1 answer

How to return an out parameter when sending a ref parameter?

I am sending a ref parameter; want to return an out parameter. Would I also need to create another method along with the ref method? This is some context to what I am working on: "Create an internal static void method that receives degrees Celsius…
Aashna
  • 5
  • 2
-1
votes
1 answer

Java: Print format with two arrays in one line and different length

I want to print a beautiful table to my console with the content of two arrays I have given. Both arrays are ArrayLists and may have a different length. Furthermore, inside both ArrayLists are arrays which have a length of 3. The problem I am…
Jan
  • 1,180
  • 3
  • 23
  • 60
-1
votes
3 answers

C# out parameter for delegate not maintaining value

I have a function which takes a custom delegate as parameter in order to achieve the following: delegate T TryParseDelegate(I input, O output); private string[] ReadMultiStringValue (string propertyName, TryParseDelegate
DMX David Cardinal
  • 599
  • 2
  • 7
  • 19
-1
votes
3 answers

WebService timeout

I deployed one webservice which calls function which going take more than 5 -6 hours. I am using this webservice on my asp.net page and I am calling this webservice asynchronously. So how should I increase webservice time out?
Vikas Shirke
  • 73
  • 2
  • 5
-1
votes
1 answer

Implement calling delegate with out parameters

I try to implement a decorator pattern for handling error in database transactions. I have no problem with standard Func and Actions, but i have difficulties with functions having out parameter. Here many topics with same question, and i figured out…
-1
votes
1 answer

"out" and "in" characters broken in Eclipse

Hey guys, Recently I installed Eclipse (Neon 4.6.3) on my Ubuntu (16.04) GNOME OS and ran into some problems, like special characters breaking on originally Windows 8 workspaces and GTK3 Gnome interface problems (had to force it to initiate on…
Souchy
  • 15
  • 2
  • 7
-1
votes
2 answers

C# method out parameter list initialization doesn't works with Clear()

I found, that construction Method(out Listlist) { list.Clear(); // doesn't allowed to initialyze Listlist list = null; // is accepted by VSTO, however, is not so good } Any suggestion please?
-1
votes
2 answers

C# DllImport : AccessViolationException when calling a vkCreateInstance

I'm trying to create a Vulkan wrapper in C#, but I have some problems when I call a function. I rewrote the vulkan.h header as follows : public static class Vk { [StructLayout(LayoutKind.Sequential)] public class Instance { } public enum…
Clematrics
  • 15
  • 8