Member '' cannot be accessed with an instance reference

前端 未结 10 1866
我在风中等你
我在风中等你 2020-11-22 10:39

I am getting into C# and I am having this issue:

namespace MyDataLayer
{
    namespace Section1
    {
        public class MyClass
        {
            publ         


        
10条回答
  •  不要未来只要你来
    2020-11-22 11:08

    cannot be accessed with an instance reference

    It means you're calling a STATIC method and passing it an instance. The easiest solution is to remove Static, eg:

    public static void ExportToExcel(IEnumerable data, string sheetName) {

提交回复
热议问题