C# preprocessor-like protection -


i wondering either possible create rule in c# inside code, prevent "compiling" , print error message of choice. example:

let's say:

  • i have method takes argument bytes vector.
  • inside method check what's length of byte vector.
  • if it's long, short etc prevent program compiling , print error message in error list.

i know use assertion , stuff, working on compiled code.

i answer no because compiler (at compilation time) can't know value of parameter @ run time.

have nice day,

alberto

edit: check first comment question because it's more complete answer compared 1 :)


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -