Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Example
- {
- public static void ModifyWithRef(ref int x)
- {
- x += 10;
- }
- public static void ModifyWithOut(out int x)
- {
- x = 20;
- }
- public static void Main()
- {
- int a = 5;
- ModifyWithRef(ref a);
- int b = 5;
- ModifyWithOut(out b);
- Console.WriteLine($"Value of a: {a}");
- Console.WriteLine($"Value of b: {b}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment