File tree 2 files changed +2
-18
lines changed
snippets/csharp/programming-guide/ref-returns 2 files changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -18,15 +18,7 @@ public ref int FindNumber(int target)
18
18
return ref numbers [ 0 ] ;
19
19
}
20
20
21
- public override string ToString ( )
22
- {
23
- string retval = "" ;
24
- for ( int ctr = 0 ; ctr < numbers . Length ; ctr ++ )
25
- {
26
- retval += $ "{ numbers [ ctr ] } ";
27
- }
28
- return retval . Trim ( ) ;
29
- }
21
+ public override string ToString ( ) => string . Join ( " " , numbers ) ;
30
22
}
31
23
// </Snippet1>
32
24
Original file line number Diff line number Diff line change @@ -20,15 +20,7 @@ public ref int FindNumber(int target)
20
20
return ref returnVal ;
21
21
}
22
22
23
- public override string ToString ( )
24
- {
25
- string retval = "" ;
26
- for ( int ctr = 0 ; ctr < numbers . Length ; ctr ++ )
27
- {
28
- retval += $ "{ numbers [ ctr ] } ";
29
- }
30
- return retval . Trim ( ) ;
31
- }
23
+ public override string ToString ( ) => string . Join ( " " , numbers ) ;
32
24
}
33
25
// </Snippet1>
34
26
You can’t perform that action at this time.
0 commit comments