我不太明白我的问题是什么。
CS0452 错误,类型 T 必须是引用类型,以便用作参数...
错误出现在这行代码:
Response<T> tableEntity = TC.GetEntity<T>(pk, rk);
using Azure;
using Azure.Data.Tables;
namespace AzureDataTables
{
public class AzureDataTables<T> : IAzureDataTables<T> where T : class, ITableEntity, new()
{
ITableEntity GetTableEntity(string pk, string rk);
}
public class AzureDataTables<T> : IAzureDataTables<T> where T : ITableEntity, new()
{
public T GetTableEntity(string pk, string rk)
{
var tableEntity = TC.GetEntity<T>(pk, rk);
return tableEntity.Value;
}
public TableServiceClient TSC { get; set; } = new TableServiceClient("");
public TableClient TC => TSC.GetTableClient("");
}
}
return tableEntity;
更改为return tableEntity.Value;
。 - Gaurav Mantri