mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.0 KiB
74 lines
1.0 KiB
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt) |
|
|
|
using System; |
|
|
|
public static class ValueTypes |
|
{ |
|
public struct S |
|
{ |
|
public int Field; |
|
|
|
public void SetField() |
|
{ |
|
this.Field = 5; |
|
} |
|
|
|
public void MethodCalls() |
|
{ |
|
this.SetField(); |
|
Test(this); |
|
Test(ref this); |
|
} |
|
|
|
static void Test(S byVal) |
|
{ |
|
} |
|
|
|
static void Test(ref S byRef) |
|
{ |
|
} |
|
} |
|
|
|
public static S InitObj1() |
|
{ |
|
S s = default(S); |
|
return s; |
|
} |
|
|
|
public static S InitObj2() |
|
{ |
|
return default(S); |
|
} |
|
|
|
public static void InitObj3(out S p) |
|
{ |
|
p = default(S); |
|
} |
|
|
|
public static S Copy1(S p) |
|
{ |
|
return p; |
|
} |
|
|
|
public static S Copy2(ref S p) |
|
{ |
|
return p; |
|
} |
|
|
|
public static void Copy3(S p, out S o) |
|
{ |
|
o = p; |
|
} |
|
|
|
public static void Copy4(ref S p, out S o) |
|
{ |
|
o = p; |
|
} |
|
|
|
public static void Copy4b(ref S p, out S o) |
|
{ |
|
// test passing through by-ref arguments |
|
Copy4(ref p, out o); |
|
} |
|
}
|
|
|