我有两个具有相同名称的函数,主要区别在于不同的返回类型.我怎么能重载函数才能使用相同的名称,因为有时我需要point3d或point3f数组,以下函数名称给出相同的错误:
public static Point3d[] GetNGonCenters(this Mesh mesh)
{
Point3d[] centers = new Point3d[mesh.Ngons.Count];
for (int i = 0; i < mesh.Ngons.Count; i++)
centers[i] = mesh.Ngons.GetNgonCenter(i);
return centers;
}
public static Point3f[] GetNGonCenters(this Mesh mesh)
{
Point3f[] centers = new Point3f[mesh.Ngons.Count];
for (int i = 0; i < mesh.Ngons.Count; i++)
centers[i] = (Point3f)mesh.Ngons.GetNgonCenter(i);
return centers;
}
Run Code Online (Sandbox Code Playgroud) 我试图检查由int [2]数组组成的列表是否包含某些元素.
总之,为什么这会产生错误?我该如何正确检查?
List < int[] > ngonPairs = new List<int[]> {new int[2] { 0, 1 }};
bool flag = ngonPairs.Contains(new int[2] { 0, 1 });
Run Code Online (Sandbox Code Playgroud)
标志总是错误的.