I want to pass a field reference to my method while an event is fired, but the reference is not passed because my field has the same value.
Here is my code:
private uint _myNumberField;
private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e)
{
HandleTextBoxChanged(sender, _myNumberField);
}
private void HandleTextBoxChanged(object textBoxObject, uint myNumber)
{
var textBox = textBoxObject as TextBox;
if (textBox == null)
return;
myNumber = 123;
}
After firing the TextBox_OnTextChanged
event the field _myNumberField
should have the value 123 but has the value 0.