我已经进行了相当多的研究,但现在我仍然不知道为什么我仍然会收到此错误。我有一个具有以下属性的结构:
struct Account
{
//private attributes
private double mBalance;
private int mAccountNumber;
private string mName;
private string mDateCreated;
}
并尝试执行以下操作:
class BankManager
{
//private attributes
private unsafe Account *mAccounts;
private unsafe bool *mAccountsAvailable;
private int mNumberAccounts;
}
即使将我的类 Account 转换为结构,对 BankManager 类中的属性使用“不安全”,并告诉编译器它可以使用不安全代码(在属性 -> 构建中),我仍然在
*mAccounts
关于为什么的任何想法?我很确定我在结构中使用的所有类型在 c# 中都有指向的指针是合法的。提前致谢!