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

C# looking for a pointer workaround

I'm trying to create a foreign key in a class, B, to the id of another class, A. The problem is that I can't verify the ID of A's objects until near the end of the program when all my instances of B have already been created. I would like to be…
user3747260
  • 465
  • 1
  • 5
  • 14
0
votes
2 answers

Using Collections and Ref Keyword

I was reading the MSDN page about the ref keyword and modified the example using a collection instead of an int, like so: public static void Main(string[] args) { List elements = new List(); Method(elements); …
user5910494
0
votes
1 answer

What parameter modifying keyword should I use?

Requirements: Variable doesn't need to be assigned when passing it into the function. (unlike ref) Variable doesn't need to be assigned in the function. (unlike out) For now, I will call the keyword mykw in the code below. public class MyObj{ …
Ryan A WE
  • 59
  • 1
  • 10
0
votes
1 answer

How to get reference auto generated elements in React?

I am currently working with react but I am now stuck with an error that I don't know how to fix. I am using mCustomScroll bar and this library automatically generates an element with the id of MCSB_1. This means that I can't attach a "ref" to it.…
mre12345
  • 1,087
  • 4
  • 16
  • 23
0
votes
0 answers

Using ref on Properties

I have a class Items public class Items { public int A1 { get; set; } public int B1 { get; set; } //... public int A9 { get; set; } public int B9 { get; set; } } and i have to compare properties (A1 and B1, A2 and B2 and so…
Byyo
  • 2,163
  • 4
  • 21
  • 35
0
votes
1 answer

using ref to delete Node in the middle of a linked list, given only access to that node

I have the solution. So I do not need help, but I have a question. This code works: public void Delete(ref Node n) { n = n.next; } LinkedList list = new…
Orvel
  • 297
  • 4
  • 13
0
votes
1 answer

C# alternative for ref/out parameters in multiple methods

i have a lot of method that take ref/out as a parameter's. I made them this way because i had my variables declared in the class that im creating the methods.Now i moved to variables to separate classes and i cant pass the variables as ref/out…
Deadzone
  • 793
  • 1
  • 11
  • 33
0
votes
1 answer

passing control indexer by reference to method to change its property

i have made a program, which include a lot of controls. The controls would be showed and hided according to the choice of the user. That means that controls overlapped on each other at design time. now i want to change the forecolor and backcolor of…
0
votes
0 answers

C++ virtual Function complie Error

#include using namespace std; class A { public: virtual void f4() { cerr << "A::f4()" << endl; } } class B : public A { public: virtual void f4(int n) { cerr << "B::f4(" << n << ")" << endl; } } class C : public B { public: virtual…
Mebighobo
  • 13
  • 1
  • 1
  • 7
0
votes
0 answers

Pass a method as a parameter with its own reference parameter

I've looked around for a while and I can't find the answer to my question - or if it is even possible. My question is not simply how to pass a method as a parameter to a second method, but whether it is possible for the method passed to use a…
C. Knight
  • 739
  • 2
  • 5
  • 20
0
votes
1 answer

What is the advantage of using the ref keyword with a reference type parameter?

What do I gain, as the developer, by passing a reference type argument to a method using the ref keyword if you are not changing what the reference points to? I have read both, ref keyword with reference type parameter and What is the use of "ref"…
Randy
  • 1,137
  • 16
  • 49
0
votes
1 answer

Subscribe to a delegate that was passed as method argument

I'm attempting to build a recurring programming pattern into a generic class for code re-use. Part of this pattern thread-safely subscribes/unsubscribes to a delegate as needed during asynchronous operations (multicast delegate used as event). The…
Sparky
  • 1
  • 1
0
votes
1 answer

Why my list JSON response is getting atribute @ref and not an object? AngularJS

I'm getting @ref value on atribute "usuario" on my list JSON response, the second row on, this is repeated, what's happening?: 1…
0
votes
1 answer

NodeJS: node-ffi, ref-struct, ref-array

I'm writing PKCS11 cryptoki wrapper using nodejs plugins ffi, ref, ref-struct and ref-array. I have this code. var hSession = this.session.handle; var hObject = this.handle; var $label = new (arrayType(cki.CK_UTF8CHAR))(80); var template = new…
Microshine
  • 731
  • 5
  • 19
0
votes
1 answer

Using Refs With Objects Stored In Tables

I'm trying to use refs to link objects between tables. Something like the following. CREATE OR REPLACE TYPE TYP_REFT AS OBJECT (A NUMBER, B NUMBER); / CREATE TABLE REFTT ( ref_id number, my_reft typ_reft ) / CREATE TABLE REFTAB (ID REF …
Coat
  • 697
  • 7
  • 18