简体   繁体   English

.NET系统范围内的EventWaitHandle名称允许的字符

[英].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.

相关问题 是.net系统范围内的垃圾收集器还是应用程序范围内的垃圾收集器? - Is the garbage collector in .net system-wide or application-wide? 如何在 .NET Core 中设置全局环境变量(用户范围或系统范围) - How to set a global environment variable in .NET Core (user-wide or system-wide) 与“系统级”媒体播放器互动 - Interact with “system-wide” media player 取消处理(取消注册)系统范围的“HotKey” - Unhandling (unregistering) a system-wide 'HotKey' 如何在C#中通过Windows资源管理器有效监视系统范围的“文件名更改事件” - How to monitor system-wide “file name change event” by windows explorer effectively in c# 如何获取系统范围的.NET Core运行时环境的基本路径? - How to get the base path of system-wide .NET Core runtime environment? 从DB处理队列时,系统范围互斥的替代方案? - alternatives to system-wide mutex when processing queue from DB? C#异步接收会导致系统范围的网络崩溃! - C# asynchronous receive causes system-wide network crash! 应用程序如何与系统范围的文本选择挂钩? - How can an app hook into text selection system-wide? Windows 7和8中的系统范围设置-注册表不再有用吗? - System-wide setting in Windows 7 and 8 - Registry is no longer useful?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM