Исключение TypeLoadException не было обработано в C#

Я новичок в C#, и у меня возникла проблема при загрузке библиотеки в мою программу. Я пытаюсь запустить этот пример в Visual Studio, но получаю сообщение об ошибке:

TypeLoadException was unhandled. Can't load type SVM.Problem from assembly SVM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

Вот как выглядит мой код:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SVM;

namespace SVM
{
class Program
{
    static void Main(string[] args)
    {
        //First, read in the training data.
        Problem train = Problem.Read("a1a.train");
        Problem test = Problem.Read("a1a.test");

        //For this example (and indeed, many scenarios), the default
        //parameters will suffice.
        Parameter parameters = new Parameter();
        double C;
        double Gamma;

        //This will do a grid optimization to find the best parameters
        //and store them in C and Gamma, outputting the entire
        //search to params.txt.
        ParameterSelection.Grid(train, parameters, "params.txt", out C, out Gamma);
        parameters.C = C;
        parameters.Gamma = Gamma;

        //Train the model using the optimal parameters.
        Model model = Training.Train(train, parameters);

        //Perform classification on the test data, putting the
        //results in results.txt.
        Prediction.Predict(test, "results.txt", model, false);
    }
}

}

Я добавил dll в качестве ссылки через обозреватель решений. Что может пойти не так?


Я начал новый проект, добавил dll в качестве ссылки, запустил проект, и теперь все работает. Очень неприятно не знать, что пошло не так, но я подозреваю, что это как-то связано с тем, что имя проекта и имя dll совпадают. Спасибо за помощь!

11
задан jjnguy 7 June 2012 в 12:42
поделиться