Closed thegreatco closed 2 years ago
Should be fine to add. Nullable property makes the most sense.
On the other hand, I think returning default
instead of null
makes more sense for consistency reasons, because we already have IConsole.CursorLeft
/IConsole.CursorTop
that are not nullable and also depend on the presence of a terminal window.
Thanks @Tyrrrz!
Can we add some way of determining the height/width of the output for
IConsole
. Similar toConsole.WindowHeight
andConsole.WindowWidth
? I've got a console app that needs to know how wide the window is that it is writing to.Since this is abstracted, maybe we can either return
null
orNotImplementedException
for implementations that don't support it? I don't have particularly strong feelings either way, butnull
could make for a better user experience,IConsole.Width.GetValueOrDefault(80)
is nicer than trying to catch an exception.Ideally I think we'd also wan to add
SupportedOSPlatform
andUnsupportedOSPlatform
attributes where appropriate.