File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 6464 <Compile Include =" Test_ByLynn.cs" />
6565 <Compile Include =" Test_ByDuskforest.cs" />
6666 <Compile Include =" test_enum.cs" />
67+ <Compile Include =" test_RefOut.cs" />
6768 <Compile Include =" test_string_switch.cs" />
6869 <Compile Include =" 没有实现的IL.cs" />
6970 </ItemGroup >
Original file line number Diff line number Diff line change 1+ using System ;
2+ using UnitTest ;
3+ using System . Collections . Generic ;
4+
5+ namespace UnitTestDll
6+ {
7+ public class test_RefOut
8+ {
9+ private class UserDefClass {
10+ public int value01 ;
11+ public string value02 = "" ;
12+
13+ public void StringToValue ( ref string v , string str ) {
14+ v = str ;
15+ }
16+ }
17+
18+
19+ public static void UnitTest_Out ( ) {
20+ Dictionary < int , UserDefClass > dict = new Dictionary < int , UserDefClass > ( ) ;
21+ UserDefClass obj = new UserDefClass ( ) ;
22+ obj . value01 = 888 ;
23+ dict . Add ( 0 , obj ) ;
24+ UserDefClass testObj ;
25+ if ( dict . ContainsKey ( 0 ) ) {
26+ testObj = dict [ 0 ] ;
27+ Logger . Log ( string . Format ( "Value01 : {0}" , testObj . value01 ) ) ;
28+ }
29+ if ( dict . TryGetValue ( 0 , out testObj ) ) {
30+ Logger . Log ( "Test OK." ) ;
31+ }
32+ }
33+
34+ public static void UnitTest_Ref ( ) {
35+
36+ UserDefClass obj = new UserDefClass ( ) ;
37+ obj . StringToValue ( ref obj . value02 , "test" ) ;
38+ Logger . Log ( obj . value02 ) ;
39+
40+ }
41+
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments