Questions tagged [ref]

The ref keyword causes an argument to be passed by reference, not by value. The effect of passing by reference is that any change to the parameter in the method is reflected in the underlying argument variable in the calling method. The value of a reference parameter is always the same as the value of the underlying argument variable.

1394 questions
0
votes
2 answers

Odd hash representation in perl

I have a hash that has the following content, dumped via Data::Dumper: $VAR1 = [ 0 ]; What does that mean? I can´t seem to understand if that "0" is a key with nothing assigned to it or any other thing. Only clue is that I got this error…
dukibas
  • 35
  • 1
  • 4
0
votes
1 answer

Array Formula Resulting in #REF Error

I am not quite sure why this is occurring, but I cannot seem to identify a solution online. I am merely attempting to copy some formulas from one sheet to another (the formula will .FillDown in the destination sheet), but I am having issues with…
CJK
  • 99
  • 7
  • 20
0
votes
4 answers

Conflict in the fact that object is a ref type

I've read about ref and value types in c# but don't know in the following example why y = 10 although x and y are reference types? object x = 10; object y = x; x = 20; Console.WriteLine(y); //why y = 10 although x and y are reference types? And if…
eman
  • 195
  • 1
  • 1
  • 8
0
votes
1 answer

DBref in MongoDB

I'm trying to make queries with MongoDB but i have a questions. Query and structure: How do I view information about the author at that job with this query? (for example I want to see the name of the autor with the information of the job)
sigLosco
  • 101
  • 3
  • 5
  • 10
0
votes
1 answer

Use of ref and this to change a variable value

I came across ref and this parameter keywords lately, and I can't find any good comparison performance wise. void main() { int original = 1; /* Which one is best? */ original = DoMaths(original, 2); DoMaths(ref original, 2); …
Arthur Rey
  • 2,990
  • 3
  • 19
  • 42
0
votes
1 answer

Conflict between passing object by reference and cs1690

This code has been UPDATED. Robot.cs: struct state systemcheck() { state stateInfo = new state(); public double x,y,z; } Main.cs: public state stateInfo; private readonly Sub cpnew; public Main() { InitializeComponent(); cpnew = new…
srivas
  • 21
  • 9
0
votes
3 answers

C# Runtime DLL loading and ref parameters

In short, I wish to load a .DLL file at runtime, and ask it to modify a ref value that I passed to it as a parameter. (the .DLL would be written in C#) but I don't know what a suitable technique would be. I have a class "ALotOfData" which contains…
0
votes
1 answer

Inserting data from table (SELECT) with REF - Oracle Database

I'm trying to insert all data from Pacient table to Pacient_OR table (Object-Relational). Is there a simple way to do that (one script), if Pacient table has column with Pojistovna_ID (foreign key) and in Pacient_OR table there is REF to the…
0
votes
1 answer

Is There a Pointer Version of ref that Supports Rvalues?

This is really two questions about ref rolled into one: Can I use ref on an rvalue? Obviously as the programmer I would have the responsibility to ensure it outlived any calling code. Is there a pointer version of ref? The goal of these two…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
0
votes
1 answer

How to change an array element later?

I'm keeping track of a node object that I would like to change later (to a different type and hence re-assign it). It's from an element of an array that I later won't have access to. I can't just keep track of the object and re-assign it because…
John Smith
  • 8,567
  • 13
  • 51
  • 74
0
votes
0 answers

Abstract Class as ref compiler error

So I've created a framework for settings in my application, all been good until I came across this little roadbump. In the abstract base class I have this: public abstract class SettingsBase { public event SettingsChangedEventHandler…
Xsjado
  • 347
  • 1
  • 10
0
votes
1 answer

Strange #REF! error in my sheet

I have an unusual case with Excel and #REF! error. I've this formula: =INDEX($N$621:$WO$621;SMALL($N626:$WO626;2);0) which gives me sometimes a proper value and sometimes gives me a #REF! error as a result. Link here. I checked all my cells and…
Areen
  • 3
  • 3
0
votes
1 answer

Using ref dynamic array parameter in C#

I am trying to make a generic method, that adds an object to the given array. I tried the below code, but I get this error: "A property, indexer or dynamic member access may not be passed as an out or ref parameter" public void Main() { Foo…
nza
  • 55
  • 5
0
votes
1 answer

Why is Visual studio adding "ref" to value types when refactoring into methods?

I don't understand a decision that Visual Studio Express 2013 makes when running the "Extract Method" refactoring. Consider the following code: public struct Foo { private readonly int x, y; public int X { get { return x; } } public int…
user1323245
  • 638
  • 1
  • 8
  • 20
0
votes
0 answers

pass datatable as ref

I am facing a problem . I have a Parent Form . Where i am creating 20 Datatable that is using to bind the combobox for child form. So i want that i create a public function .I want to pass the datatable that is created on my Parent form i can use on…
A.Goutam
  • 3,422
  • 9
  • 42
  • 90