[英].NET system-wide EventWaitHandle name allowed characters
I'm just curious off hand, are there any restrictions on the naming of a system-wide EventWaitHandle
? 我只是好奇,对系统范围内EventWaitHandle
的命名有任何限制吗? I want to use a URL as the name for one, but it could have a great deal of odd characters, I don't want it to silently fail or some other such, so just checking up on here if there are any known illegal characters for the names of these. 我想使用一个URL作为一个名称,但是它可能包含大量的奇数字符,我不希望它默默地失败或其他类似的字符,所以只要在此处检查是否有任何已知的非法字符这些的名称。
I tried finding this myself, but my google-fu wasn't up to snuff. 我试图自己找到这个,但我的Google-fu并没有sn灭。
Here it is. 这里是。 See the CreateEvent function documentation. 请参阅CreateEvent函数文档。
The name can have a "Global\\" or "Local\\" prefix to explicitly create the object in the global or session namespace. 该名称可以具有“ Global \\”或“ Local \\”前缀,以在全局或会话名称空间中显式创建对象。 The remainder of the name can contain any character except the backslash character (\\). 名称的其余部分可以包含除反斜杠字符(\\)之外的任何字符。
Also see Kernel Object Namespaces . 另请参见内核对象命名空间 。
The "Session\\" prefix is reserved for system use and you should not use it in names of kernel objects. “ Session \\”前缀保留供系统使用,您不应在内核对象的名称中使用它。
This is the wrong way to think about this. 这是错误的思考方式。 By far the most important feature of the name that you pick is that is unique . 到目前为止,您选择的名称的最重要特征是独一无二 。 People suck at picking unique names, there are far too many guys called Hans in this world. 人们很喜欢选择独特的名字,这个世界上有太多被称为汉斯的家伙。
Leave it up to a machine to pick a globally unique ID. 将其留给计算机来选择全局唯一ID。 You already know it as a Guid. 您已经知道它是Guid。 In Visual Studio, click Tools + Create GUID. 在Visual Studio中,单击“工具” +“创建GUID”。 Bullet #4 is what you want, copy/paste it into your code and put quotes around it. 项目符号4是您想要的,将其复制/粘贴到您的代码中并在其两边加上引号。 Prefix with Global\\\\
to make it system-wide. 使用Global\\\\
前缀在整个系统范围内。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.