repo.or.cz
/
mono-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[metadata] Use MONO_PROFILER_API on MonoClass getters in checked builds (#20440)
[mono-project.git]
/
mcs
/
errors
/
cs0151-2.cs
blob
d2b8028c978a819fcca8d65a32d4d1ccd02f5184
1
// CS0151: A switch expression of type `Y' cannot be converted to an integral type, bool, char, string, enum or nullable type
2
// Line: 28
3
4
class
Y
{
5
byte
b
;
6
7
public static implicit operator int
(
Y i
)
8
{
9
return
i
.
b
;
10
}
11
12
public static implicit operator byte
(
Y i
)
13
{
14
return
i
.
b
;
15
}
16
17
public
Y
(
byte
b
)
18
{
19
this
.
b
=
b
;
20
}
21
}
22
23
class
X
{
24
static void
Main
()
25
{
26
Y y
=
new
Y
(
1
);
27
28
switch
(
y
){
29
case
0
:
30
break
;
31
case
1
:
32
break
;
33
}
34
35
int
a
=
y
;
36
}
37
}