What do the hash signs in #if, #else, #end if mean?

前端 未结 3 925
耶瑟儿~
耶瑟儿~ 2020-12-05 14:07

I\'m writing code to check if a file is available to be checked out of SharePoint and, if it isn\'t, alert the user and tell them that the file is in use by someone else and

相关标签:
3条回答
  • 2020-12-05 14:29

    The accepted answer is correct that your first code example are compile directives.

    It's worth pointing out in case someone else comes across this question that your second code example is a different thing. In this case these are file numbers used to identify text streams. You will see them used in the context of the commands below. They are completely unrelated to compiler directives.

    Open "c:\test.txt" For Input As #hdlFile Input #hdlfile Print #hdlfile Write #hdlfile Close #hdlfile

    0 讨论(0)
  • 2020-12-05 14:31

    The hash symbols represent a preprocessor command, which are commands that are processed prior to compilation, essentially producing dynamic / conditional code. These types of commands are often used in languages such as C/C++ to manage cross-platform programming techniques. A common usage is to check for a particular environment or platform (ie. VBA, Windows, MacOSX, etc), and then implement platform-specific code.

    http://en.wikipedia.org/wiki/Preprocessor

    0 讨论(0)
  • 2020-12-05 14:49

    The hash indicates that it's a directive. Used for literally including or excluding code from compilation.

    http://msdn.microsoft.com/en-us/library/7ah135z7.aspx

    whoops that's for vb.net isn't it. Same concept I think.

    0 讨论(0)
提交回复
热议问题