C# 错误:不包含'';没有扩展方法

C# 错误:不包含'';没有扩展方法,c#,C#,我的代码给出了这个错误 “Net.Kniaz.AHP.AHPModel”不包含“AddCriteria”的定义,并且找不到接受“Net.Kniaz.AHP.AHPModel”类型的第一个参数的扩展方法“AddCriteria”(是否缺少using指令或程序集引用?) 我不知道问题出在哪里。我回顾了几个类似的问题,但仍然找不到解决方案 using System; using System.Collections.Generic; using System.Linq; using System.Te

我的代码给出了这个错误

“Net.Kniaz.AHP.AHPModel”不包含“AddCriteria”的定义,并且找不到接受“Net.Kniaz.AHP.AHPModel”类型的第一个参数的扩展方法“AddCriteria”(是否缺少using指令或程序集引用?)

我不知道问题出在哪里。我回顾了几个类似的问题,但仍然找不到解决方案

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetMatrix;
using GeneralMatrix;
using NUnit.Framework;
using Net.Kniaz.AHP;

namespace Net.Kniaz.AHP
{
 public class AHPModel
 {
     public AHPModel(int n, int m);     

     private GeneralMatrix _criteria;
     private GeneralMatrix _choiceMatrix;
     private GeneralMatrix _orderedCriteria;
     private GeneralMatrix _calculatedChoices;
     private int _ncriteria;
     private int _mchoice;
     private int _superDim;
  }
public class TestAHP
{
public void TestVacationSpotSelection()
{
        double[][] criteria = new double[][]
                            { 
            new double[]       {1,5,0.33333333,1},
            new double[] {0,1,0.2,0.5},
            new double[] {0,0,1,3},
            new double[] {0,0,0,1}
                            };

        double[][] activitiesChoices = new double[][]
            {
                new double[] {1,4,3},
                new double[] {0,1,2},
                new double[] {0,0,1}
            };

        double[][] nightlifeChoices = new double[][]
            {
                new double[] {1,0.5,0.3333333},
                new double[] {0,1,0.5},
                new double[] {0,0,1}
            };

        double[][] siteseeingChoices = new double[][]
            {
                new double[] {1,0.142857,0.2},
                new double[] {0,1,2},
                new double[] {0,0,1}
            };

        double[][] costChoices = new double[][]
            {
                new double[] {1,3,5},
                new double[] {0,1,2},
                new double[] {0,0,1}
            };

        //4 criteria, 3 choices


        AHPModel model = new AHPModel(4,3);
        model.AddCriteria(criteria);
        model.AddCriterionRatedChoices(0,activitiesChoices);
        model.AddCriterionRatedChoices(1,nightlifeChoices);
        model.AddCriterionRatedChoices(2,siteseeingChoices);
        model.AddCriterionRatedChoices(3,costChoices);

        model.CalculateModel();

        GeneralMatrix calcCriteria = model.CalculatedCriteria;
        GeneralMatrix results = model.ModelResult;
        GeneralMatrix choices = model.CalculatedChoices;
        //choices: SF 42%, Orlando31%, NY 27%


Assert.AreEqual(31,System.Math.Round(choices.GetElement(0,0)*100,0));
Assert.AreEqual(42,System.Math.Round(choices.GetElement(1,0)*100,0));
Assert.AreEqual(27,System.Math.Round(choices.GetElement(2,0)*100,0));

错误出现在末尾(模型)的第(5到13)行。

您的类AHPModel显然没有方法AddCriteria…

您试图使用的是一段不存在的代码

 public class AHPModel
 {
 public AHPModel(int n, int m); 
 private GeneralMatrix _criteria;
 private GeneralMatrix _choiceMatrix;
 private GeneralMatrix _orderedCriteria;
 private GeneralMatrix _calculatedChoices;
 private int _ncriteria;
 private int _mchoice;
 private int _superDim;
/*private void AddCriteria(object o);*/ //<-ghost code
}
public类AHPModel
{
公共AHP模型(int n,int m);
私有通用矩阵标准;
私人通用矩阵(选择矩阵),;
私有通用矩阵_orderedCriteria;
私有通用矩阵(计算选择),;
私人国际图书馆;
私人国际选择;
私人国际超视距;

/*private void AddCriteria(object o);*///你能确切地告诉我应该做什么吗,我是一个初学者实际上我想做的是使用这个项目引用另一个不可执行的项目,所以这个部分确实存在于另一个项目中