此问题源于"备注"(第五行)下LinkedList上的MSDN页面.
包含引用类型的列表在同时创建节点及其值时执行得更好.LinkedList接受null作为引用类型的有效Value属性,并允许重复值.
我搜索了源代码,没有什么能让我真正脱颖而出.难道这条线路曾经是真的但却被遗忘了吗?如果没有,那为什么会这样呢?
HubConnection我正在尝试通过C# .NET 客户端中的a 传递 access_token 。但是,结果与我通过 TypeScript 客户端看到的结果不一致。这种不一致会导致 C# .NET 客户端中的授权失败,但 TypeScript 客户端中的授权成功。
这是相关代码:
打字稿
var builder = new signalr.HubConnectionBuilder();
builder.withUrl(hubUrl, {accessTokenFactory: () => token});
Run Code Online (Sandbox Code Playgroud)
C#
var builder = new HubConnectionBuilder();
builder.WithUrl(url, o => {
o.AccessTokenProvider = () => Task.FromResult(_token);
//I've tried the following as well
//o.Headers.Add("Authorization", "Bearer " + _token);
});
Run Code Online (Sandbox Code Playgroud)
TypeScript 代码生成一个 HTTP 请求,如下所示:
POST http://localhost:5000/machine/negotiate?negotiateVersion=1 HTTP/1.1
Host: localhost:5000
Connection: keep-alive
Content-Length: 0
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoidGVzdCIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6IkFkbWluaXN0cmF0b3IiLCJleHAiOjE1NzYxODYwMTYsImlzcyI6Im5TY3J5cHQsIEluYy4iLCJhdWQiOiJuU3R1ZGlvIFVzZXIifQ.qxAzu-NgzlnfCqyysiML4Z0_s6UBTeRb7wcuGno9rk4
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, …Run Code Online (Sandbox Code Playgroud) 所以我有一个 App.config 文件设置如下:
<configuration>
<appSettings>
<add key="Description" value="My too long of a\n description that needs\n new lines so the entire\n thing can be seen."/>
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
现在,在运行时,我需要将Texta 的属性更改Label为 App.config 文件中的众多描述之一。如果我在 App.config 中包含新行字符,Label似乎会忽略它是一个新行字符,而是按字面打印出来。但是,如果我要删除这些新行字符并在运行时插入它们,那么系统Label将识别它们并按应有的方式插入新行。
我的问题是,为什么?Label如果它们来自 App.config,为什么会忽略它们并逐字打印它们?
要使用 App.config 中的描述,我要做的就是:
myLabel.Text = ConfigurationManager.AppSettings["Description"];
Run Code Online (Sandbox Code Playgroud)