-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// CS0030: Cannot convert type `TestCase.MyEnum' to `TestCase.OSType' | ||
// Line: 9 | ||
|
||
public class TestCase | ||
{ | ||
static void Main () | ||
{ | ||
MyEnum me = MyEnum.Value1; | ||
OSType os = (OSType)me; | ||
} | ||
|
||
struct OSType { | ||
int value; | ||
|
||
public int Value { | ||
get { return Value; } | ||
} | ||
|
||
public OSType (int value) | ||
{ | ||
this.value = value; | ||
} | ||
|
||
public static implicit operator OSType (int i) | ||
{ | ||
return new OSType (i); | ||
} | ||
} | ||
|
||
enum MyEnum { | ||
Value1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters