c# - CodeGeneration 到 Json 文件的构建时间类
问题描述
我想知道是否可以在构建 dotnet 核心期间创建一个流程来执行以下操作。
假设我有一个包含属性的 json 文件:
[
{
"name": "Jack",
"age": "12",
"issue": "some issue"
},
{
"name": "Jhon",
"age": "132",
"issue": "some issue - 1"
}
]
和一个匹配的类 Preson
public class Person
{
public string Name {get;}
public string Age {get;}
public string Issue {get;}
public Person(string age, string age, string issue)
{
...
}
}
在构建时间或使用分析器时,我想创建一个这样的类
public static class Persons
{
public static Person Jhon => return new Person(...);
}
任何想法 ?
解决方案
推荐阅读
- javascript - 使 JavaScript 间隔与实际时间同步
- javascript - Vanilla Javascript - window.onscroll。为什么 ”" 滚动时不显示
- prolog - 如何从此代码中删除回溯?
- node.js - 将模块部署到运行 node.js 的远程服务器
- biztalk - 来自多出现节点的 BizTalk WCF-WebHttp 映射表单数据变量
- python-2.7 - 洪水填充以获得可用的细胞
- raspberry-pi - 如何连接 Raspberry Pi 3 和 FPGA cylone IV E Altera 进行 Uart 通信
- android - 如何为我的 Android 应用实现旋转横幅?
- postgresql - 可能的索引问题?- 如何提高查询速度?
- mysql - 错误:(gcloud.sql.instances.describe)HTTPError 404:Cloud SQL 实例不存在,但它确实存在?