From 64d85c7f3d7f4a40f365c60e4fe60fe2091e7ed3 Mon Sep 17 00:00:00 2001 From: liiir1985 Date: Mon, 25 Jul 2022 10:15:04 +0800 Subject: [PATCH] Added one more test case for ref out --- TestCases/RefOutTest.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/TestCases/RefOutTest.cs b/TestCases/RefOutTest.cs index 8afcebbc..a41e7fc6 100644 --- a/TestCases/RefOutTest.cs +++ b/TestCases/RefOutTest.cs @@ -295,6 +295,25 @@ public static void UnitTest_RefTest3() Console.WriteLine(arr[1]); } + public static void Set(ref long x) + { + x++; + } + + public static void UnitTest_RefTest4() + { + long srcX = 10; + + for (var index = 0; index < 10; index++) + { + long x = srcX; + Console.WriteLine(x); + if (x != 10) + throw new Exception(); + Set(ref x); + } + } + static void Func(ref int[] arr) { arr[1] = 2;