当前位置:网站首页>解决C#非静态字段、方法或属性“islandnum.Program.getIslandCount(int[][], int, int)”要求对象引用
解决C#非静态字段、方法或属性“islandnum.Program.getIslandCount(int[][], int, int)”要求对象引用
2022-08-02 06:01:00 【xqlily】
在c#里面运行一段二维数组的代码:
在主函数main里调用了下面这个代码时
getIslandCount(map, row, col);
报错标题中的错误:
非静态字段、方法或属性“islandnum.Program.getIslandCount(int[][], int, int)”要求对象引用
在main函数之前是如下定义这个函数的:
public int getIslandCount(int[][] map, int row, int col)
那么只需把上面这行代码改为:
public static int getIslandCount(int[][] map, int row, int col)
错误就解决了,就是只加一个static就可以了。
边栏推荐
猜你喜欢
随机推荐
Ant three sides: MQ message loss, duplication, backlog problem, what are the solutions?
MySQL高级SQL语句
MySQL - Multi-table query and case detailed explanation
HCIP BGP综合实验 建立对等体、路由反射器、联邦、路由宣告及聚合
MySQL 23道经典面试吊打面试官
chrome 插件开发指南
npm 和 yarn的区别
武汉高性能计算大会2022举办,高性能计算生态发展再添新动力
HCIP 第四天
nodejs的安装和全局配置(超详细哦)
MySQL Advanced SQL Statements
APT + Transform to realize multi module Application distributed Application life cycle
MySQL 5.7 安装教程(全步骤、保姆级教程)
Not annotated parameter overrides @NonNullApi parameter
Difference between npm and yarn
Nacos installation configuration and single-machine deployment tutorial
Go inside the basic knowledge
Kingdee International: Lost in half a year and last year, how does the business model of frantically burning money continue
leetcode solves the linked list merge problem in one step
MySQL high-level statements (1)