方法或委托参数不能是“type”类型
.NET Framework 类库中的一些类型,例如 TypedReference、RuntimeArgumentHandle 和 ArgIterator 不能用作 in、ref 或 out 参数,因为它们有可能会被用来执行不安全的操作。
下面的示例生成 CS1601:
// CS1601.cs
using System;
class MyClass
{
public void Test1(in TypedReference t) // CS1601
{
}
public void Test2(ref TypedReference t) // CS1601
{
}
public void Test3(out ArgIterator t) // CS1601
{
t = default;
}
}