Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net core 没有空<;T>;数组类中的方法?_.net Core_Asp.net Core 3.1 - Fatal编程技术网

.net core 没有空<;T>;数组类中的方法?

.net core 没有空<;T>;数组类中的方法?,.net-core,asp.net-core-3.1,.net Core,Asp.net Core 3.1,为什么编译器告诉我它不存在?我已经安装了最后一个SDK,并将netcoreapp3.1作为目标框架 public SomeDefinedType[]GetRecords() { 返回新的System.Array.Empty(); } 是一个返回空数组而不是类型的函数。它不能与new一起使用。只需返回函数的结果: public SomeDefinedType[] GetRecords() { return System.Array.Empty<SomeDefinedType>(

为什么编译器告诉我它不存在?我已经安装了最后一个SDK,并将netcoreapp3.1作为目标框架

public SomeDefinedType[]GetRecords()
{
返回新的System.Array.Empty();
}
是一个返回空数组而不是类型的函数。它不能与
new
一起使用。只需返回函数的结果:

public SomeDefinedType[] GetRecords()
{
    return System.Array.Empty<SomeDefinedType>();
}
public SomeDefinedType[]GetRecords()
{
返回System.Array.Empty();
}

发布您的代码。图像不能被谷歌搜索或编译。没有丢失。您可能试图使用错误的
数组
类。您可能有一个库,它还定义了一个
数组
Hi,欢迎使用堆栈溢出。请注意,@PanagiotisKanavos提到的关于发布代码的内容意味着您应该发布一个,而不仅仅是屏幕截图中内容的文本版本。实际上,我们需要查看您的实际代码,或者至少是一小部分仍然存在问题的代码,否则这里的任何人都无法回答您的问题,只能提供一些东西来进行查看和猜测应该在何时执行
int[]myArray=Array.Empty()
;希望我做得更多clear@liruxed删除新的
Array.Empty()
是一个返回空数组而不是类型的函数