Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does passing by reference really work in C#?

I am wondering how passing by reference works in C#. If I pass a WPF DataGrid control by reference to a function, and slowly have the function add items to its DataGrid.Items collection, will the DataGrid in the UI update with each new DataGrid.Items.Add() call? Or will it only update when the function returns? I would like to achieve the former scenario, so if passing by reference doesn't do the trick, I would love some advice on how to accomplish this. Thanks in advance.

like image 754
Doug Avatar asked Oct 08 '22 15:10

Doug


1 Answers

if u want the former scenario, then call the function UpdateLayout() of datagrid in the next statement after you use Add() method. Hope this will help.

like image 121
yo chauhan Avatar answered Oct 12 '22 12:10

yo chauhan