上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 46 下一页
摘要: 提问 标准的WebApi应该有哪些元素 回答 声明完整的响应码200,404,401,400 添加Operation 添加Tag聚合业务 申明请求和响应类型 标注参数来源FromHeader 使用ActionResult 代替IActionResult 简化 [ProducesResponseTyp 阅读全文
posted @ 2023-04-15 14:17 东百牧码人 阅读(23) 评论(0) 推荐(0)
摘要: 提问 如何WebApi 设置字段序列化别名 回答 [JsonProperty(PropertyName = "access_token"), JsonPropertyName("access_token")] 阅读全文
posted @ 2023-04-13 17:04 东百牧码人 阅读(41) 评论(0) 推荐(0)
摘要: 提问 C# 如何获取下个月 回答 int year=2022; int month=10; new DateTime(year, trace.Month, 1, 0, 0, 0, 0).AddMonths(1); 千万不要,因为在month=12时直接报错 int year=2022; int mo 阅读全文
posted @ 2023-04-13 15:26 东百牧码人 阅读(141) 评论(0) 推荐(0)
摘要: 提问 C# Channel有哪些技巧 回答 判断管道中是否还有任务 return _channel.Reader.Count > 0; 结合Channel.CreateUnbounded (无边界管道)可实现整体任务缓存,避免重复写入 慎用ChannelWriter.Complete 这会造成管道关 阅读全文
posted @ 2023-04-13 09:56 东百牧码人 阅读(119) 评论(0) 推荐(0)
摘要: 提问 线程中的终极异常处理处理 回答 为了异常阻塞主线程是不值得的 使用事件通知方式,这样不会阻塞主线程 捕捉AggregateException 阅读全文
posted @ 2023-04-11 08:54 东百牧码人 阅读(28) 评论(0) 推荐(0)
摘要: 提问 wix服务恢复 回答 <?xml version="1.0" encoding="UTF-8"?> <?include Configuration.wxi?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="h 阅读全文
posted @ 2023-04-10 15:10 东百牧码人 阅读(24) 评论(0) 推荐(0)
摘要: 提问 如何写列表example注释 回答 使用[] 示例 /// <summary> /// 集合 /// </summary> /// <example>["asdfasdfeadfadf"]</example> public List<string>? Orders{ get; set; } 阅读全文
posted @ 2023-04-10 13:26 东百牧码人 阅读(21) 评论(0) 推荐(0)
摘要: 提问 如何使用PLINQ 回答 在集合上应用AsParallel(); 假如顺序很重要则增加AsOrdered() 参考 阅读全文
posted @ 2023-04-07 08:45 东百牧码人 阅读(13) 评论(0) 推荐(0)
摘要: 提问 WebApi接口如何用户名非数字参数验证 回答 [RegularExpression(pattern: @"^\D*$", ErrorMessage = "numeric user names not supported")][FromHeader(Name = "user_name")] s 阅读全文
posted @ 2023-04-06 11:27 东百牧码人 阅读(18) 评论(0) 推荐(0)
摘要: 提问 Parallel 会阻塞调用者吗 回答 会 原因 虽然parallel也是基于线程池,但是他也会阻塞调用者 阅读全文
posted @ 2023-04-06 09:19 东百牧码人 阅读(22) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 46 下一页