【发布时间】:2016-11-11 14:26:06
【问题描述】:
我正在尝试让以下代码在 ubuntu linux 上运行的 dotnet 核心中工作 - 但在此行上出现“字符串不包含复制定义”编译错误 - 显然 String.Copy 不支持dotnet-core:
Attendance = String.Copy(markers) };
在 dotnet Core 中进行浅字符串复制的最佳方法是什么?我应该使用 string.CopyTo 吗?
谢谢
//I want to add an initial marker to each record
//based on the number of dates specified
//I want the lowest overhead when creating a string for each record
string markers = string.Join("", dates.Select(p => 'U').ToArray());
return logs.Aggregate( new List<MonthlyAttendanceReportRow>(), (rows, log) => {
var match = rows.FirstOrDefault(p => p.EmployeeNo == log.EmployeeNo);
if (match == null) {
match = new MonthlyAttendanceReportRow() {
EmployeeNo = log.EmployeeNo,
Name = log.FirstName + " " + log.LastName,
Attendance = String.Copy(markers) };
rows.Add(match);
} else {
}
return rows;
});
【问题讨论】:
-
类似的问题是的,但是这个问题是在另一个问题之前 2 个月被问到的?不知道如何处理。
-
是的,看起来这个问题得到的关注较少,我的错:(
标签: .net-core