struct MyStruct : int
{
.../...
}
The MSDN states that after the :
is the list of the implemented interfaces, but int
is quite a curious interface to me...
Is it maybe a way to define the size of the struct? Someting like a bitfield?
It is illegal and means nothing whatsoever.
Error 5 Type 'int' in interface list is not an interface redacted\\Program.cs 13 23 ConsoleApplication9
However! If by int
you mean "an interface", then it means: "this is a value-type that implements an interface"
You can't, however, have an interface called int
, since int
is a reserved keyword. You would have to refer to that as @int
in the C#.
here struct MyStruct : int
is not an interface so complier will fail this
If you have Resharper it will warn you by underlining it red before even running the build
For knowledge int is an Alias of System.Int32 and it is a structure
看起来Struct实际上应该说Enum,然后才有意义。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.