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

CheckReaderCount method of XmlSerializationReader class? Why it would be taking int parameter by "ref"?

I have not much worked around with value type pass by refrence, but long back i had passed a struct by ref, today I hit upon a function in .net framework "CheckReaderCount" which takes 2 int by "ref" i was wondering what it exactly would be…
Pritesh
  • 1,938
  • 7
  • 32
  • 46
0
votes
1 answer

DllImport how to get single values by reference

What's the appropiate signature/marshall attribute to be able to get output params using pointers params? So far I tried this: // Function to calculate the norm of vector. !0 on error. // int err_NormVec(int size, double * vector, double *…
fprades
  • 15
  • 1
  • 8
-1
votes
1 answer

property of array^ type

i am having problems declaring a property in C++ of array^ type. I did it this way.. array^ variable = gcnew array(10); property array^ PROPERTY { array
Jasim Khan Afridi
  • 776
  • 3
  • 15
  • 28
-1
votes
2 answers

Typing for an Array of Refs

I'm trying to create a component that allows for the user to click outside it. To do this I need to create a ref for each component that requires the functionality. This is what I'm trying to type for. I'm struggling to find a fix for the error…
Lauro235
  • 121
  • 1
  • 8
-1
votes
0 answers

Does it make sense to use the ref keyword for value types for optimization reasons in C#?

I'm writing a voxel world generator for the game. And I want to make it as fast as possible. And in theory it makes sense to pass structures like Vector3 (UnityEngine) and other "heavy" structures through the ref keyword to methods. Tests through…
Tirais
  • 7
  • 3
-1
votes
3 answers

Create ref for elements in loop

I have an array of react elements that I output using the map function: { elemsList.map((item, i) => { return (
Listopad02
  • 131
  • 1
  • 6
-1
votes
1 answer

Click away listener with select component as a child

In example below there is container that contains few elements. Everything works fine instead of nested Select element. When clicking select, it detects as if the click happened outside the red container Codesandbox example
-1
votes
1 answer

Why is it dangerous to use ref in a recursive method?

I was solving the following problem on leetcode: Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. Following is the…
Vikram Singh
  • 435
  • 2
  • 10
-1
votes
1 answer

Vue 3 ref Proxy unaccessible

I am trying to get data from an API and want to reuse it inside my script. I am using a ref to store the data. Usually i can access my data via myRef.value. But i do observe some behaviour that makes it complicated to access my data inside the…
haligh
  • 9
  • 3
-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 render the function inside addEventListener load in reactjs or nextjs?

const Test = () => { const [ reload , setReload ] = useState('') useEffect(() => { console.log("useEffect Reloded"); document.getElementById( "img" )!.addEventListener('load' , () => { console.log("img loaded") …
-1
votes
1 answer

How with formspree use preventDefault()?

I'm struggling with issue that my react form doesn't reset after clicking submit. I'm using antd form with sending mails with formspree. How I can manage my code for resetting values of my input fields with non reloading page after submitting…
Mikołaj Wittbrodt
  • 399
  • 1
  • 4
  • 18
-1
votes
2 answers

Add Where clause to IQueryable in function?

Why Where clause is not applied to IQueryable in the AddWhereToQuery function ? It should be reference type and I cannot see why this code should not work as I expect. [Route("/testing")] public class MyTestController : ControllerBase { private…
Hromis
  • 1
  • 2
-1
votes
1 answer

How to prevent the browser window from scrolling when scrolling to item in list on page?

I have a scrollable list of elements on the page, divided into sections. Each section is associated with a tab of the section name above the list. When I click on a particular Tab, the list scrolls automatically to the section of the tabs name.
lcnw
  • 117
  • 2
  • 6
-1
votes
1 answer

why i can not use passed refs in input element

I am trying to focus on error fields inside of a form and I am using ref to do that but somehow ref always returns null and I am getting errors, I want to use/pass this ref to focus on error field , here error is stored in state which i have not…
Curious_guy
  • 161
  • 11