out Questions
6
Solved
I tried this earlier today:
public interface IFoo
{
IEnumerable<int> GetItems_A( ref int somethingElse );
IEnumerable<int> GetItems_B( ref int somethingElse );
}
public class Bar :...
Intrados asked 15/6, 2009 at 23:48
7
Solved
Consider a function which returns two values. We can write:
// Using out:
string MyFunction(string input, out int count)
// Using Tuple class:
Tuple<string, int> MyFunction(string inp...
Baca asked 17/6, 2011 at 6:1
3
Solved
I'm trying to create a procedure that will enter data and then return a message in the OUT parameter, however i'm getting this message "argument 5 for routine hospital.alextest10 is not a vari...
Shanika asked 17/3, 2012 at 16:33
3
Solved
C# allows to mark function argument as output only:
void func(out int i)
{
i = 44;
}
Is it possible to do something similar in C/C++? This could improve optimization. Additionally is should sil...
Nafis asked 10/6, 2015 at 9:21
15
Solved
I want to write an async method with an out parameter, like this:
public async void Method1()
{
int op;
int result = await GetDataTaskAsync(out op);
}
How do I do this in GetDataTaskAsync?
Slype asked 10/9, 2013 at 10:50
4
Solved
I have a mail template newsletter here:
http://www.newsletter.vendopor.com/m29-04-13/index2.html
But at the end, have a paragraph that contains that text:
Por favor, envía este correo a las persona...
3
Solved
Using this construct:
var dict = new Dictionary<int, string>();
var result = (dict?.TryGetValue(1, out var value) ?? false) ? value : "Default";
I get an error saying CS0165 use of unassig...
Aras asked 17/3, 2019 at 12:25
2
I would like to verify that a method is only called once.
mock.Verify(x => x.Method("String", out It.IsAny<StringBuilder>()), Times.Once);
I don't care about the second parameter, it co...
Mycetozoan asked 23/4, 2018 at 10:12
28
Solved
I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between:
public void myFunction(ref MyClass someClass)
and
public void ...
15
Solved
Is it possible to assign an out/ref parameter using Moq (3.0+)?
I've looked at using Callback(), but Action<> does not support ref parameters because it's based on generics. I'd also prefera...
Conlon asked 1/7, 2009 at 9:6
3
Solved
Microsoft's documentation for the out parameter modifier points out the following:
Declaring a method with out arguments is a classic workaround to return multiple values. Consider value tup...
Juliajulian asked 15/10, 2022 at 21:2
7
Solved
Currently when trying to do something in a method that takes an out parameter, I need to assign the value of the out parameter in the method body, e.g.
public static void TryDoSomething(int value,...
Stigmasterol asked 29/5, 2014 at 12:33
3
Solved
I just learned that having a generic argument as the type of an out parameter forces that generic type to be invariant. This is surprising to me. I thought out parameters are treated the same as re...
1
Solved
Given this code:
private void TryIt(Dictionary<int, int> myDict)
{
if (myDict?.TryGetValue(1, out int myValue) ?? false)
{
Console.Out.WriteLine(myValue); // <-- Error CS0165
}
...
Conventual asked 10/4, 2019 at 22:26
3
Solved
I'm trying to print binary tree
void print_tree(Node * root,int level )
{
if (root!=NULL)
{
cout<< root->value << endl;
}
//...
}
How can I indent output in order to inde...
1
Solved
I'm having the following static C# method
public static bool TryParse (string s, out double result)
which I would like to call from Python using the Python NET package.
import clr
from System i...
Bugloss asked 14/2, 2019 at 14:4
3
The code metrics analyser in Visual Studio, as well as the code metrics power tool, report the number of lines of code in the TestMethod method of the following code as 8.
At the most, I would exp...
Jeromyjerreed asked 26/10, 2012 at 10:28
5
Solved
Say I have the following code:
static void Fjuk(out string str)
{
str = "fjuk!";
throw new Exception();
}
static void Main(string[] args)
{
string s = null;
try
{
Fjuk(out s);
}
catc...
2
Solved
In C# 7 we can do like this:
byte.TryParse(p.Value, out _)
or like this
byte.TryParse(p.Value, out var _)
Are there any differences?
8
Solved
I'm making a call:
myResult = MakeMyCall(inputParams, out messages);
but I don't actually care about the messages. If it was an input parameter I didn't care about I'd just pass in a null. If it...
6
Solved
My application has many System.out.println() statements.
I want to catch messages from println and send them to the standard logger (Log4j, JUL etc).
How to do that ?
Passport asked 12/7, 2010 at 12:20
1
Solved
From https://blogs.msdn.microsoft.com/dotnet/2017/03/09/new-features-in-c-7-0/:
We allow "discards" as out parameters as well, in the form of a _, to let you ignore out parameters you don’...
0
With the introduction of ValueTuples in C# 7.0 we can now have multiple return values:
public (int sum, int count) GetTallies()
{
return (1, 2);
}
I'm under the impression that the sole ...
7
Solved
What is the easiest way to do a clickout in jquery Where a div box hides if clicked anywhere outside it.
1
Solved
I have a library with the following code:
double result = -1;
if (!string.IsNullOrEmpty(fieldName))
{
string value = HttpContext.Current.Request.QueryString[fieldName];
if (string.IsNullOrEmpty...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.