Select Page

C# Boxing and Unboxing variables

When using variables in C# you need to be aware of and careful with boxing and unboxing. For example the following code; int discount = 20; object discPerc = discount; discount = 15; int discPercent = (int)discPerc; In this instance the value of discount is 15 but the...
%d bloggers like this: