c# - 如何用 GenFu 填充数组
问题描述
在具有 Array 的类上使用 GenFu 不起作用,这是一个最小的可重现示例:
public class Row
{
public int Id { get; set; }
public string[] Cell = new string[5];
}
public void Test() {
//This line works with a defined property
GenFu.GenFu.Configure<Row>().Fill(r => r.Id, () => { return i++; });
//This line fails (Object Ref not set to an instance)
GenFu.GenFu.Configure<Row>().Fill(r => r.Cell[0], () => { return "Row " + i++.ToString(); });
}
当它们是数组时如何填充单元格,或者这是库的限制?
解决方案
推荐阅读
- javascript - Mouseenter 委托问题 vanilla js
- python - 回文分区时间复杂度
- python - 我可以在后台线程中处理对 Flask 服务器的 POST 请求吗?
- java - 使用 qf 参数时找到 Solr 搜索查询结果
- karate - ## 运算符对 JSON 对象的行为
- java - 在android studio中,这个错误信息是什么意思?
- python - 如何在另一个函数文件中使用函数文件中的变量?
- node.js - Mongo Aggregate 使用 $geonear 和子文档表
- csv - 来自 encoding/csv pkg 的写入函数停止写入 csv 文件
- java - Java中的IdentityHashMap源代码中的retryAfterResize:for(;;)语法是什么意思