How do I get the compiler to select the BinaryWriter.Write overload that I want?

I use binary readers and writers to read / write data to a file. For example, for this:

MyWriter.Write(Ord(TMyEnum(2)));

I expect it to write SmallInt for reading with

MyReader.ReadSmallInt

But in the IDE, I see that it writes a byte. How to get the author to write the type I want?

+4
source share
1 answer

Pass it Smallint

Smallint(SomeEnum)
+4
source

Source: https://habr.com/ru/post/1537387/


All Articles