none
error of method not found in C# class in VS 2013 on win7 RRS feed

  • Question

  • I am changing a C# code in a solution (it has many files and projets) from VS 2013 on win 7.

    I added some properties in class1. It was built well.

    But, it has run-time error:

      Method not found : class1.set_p1(system.string)

    The code logic is as follows:

     public class class1
     {
         public string p1 {get; set;} // **have updated**
     }

    class1 is defined in a C# project that has been added in the solution.

      public abstract class class2 : class1
      class2 ins2; 
      ins2.p1 = myData.order.data_file; // myData is from an xml file after deserialize and serialize, data_file is a file path.

    I have cleaned up the solution before building. I have also search the error online but none of them can solve my problems.

    Any help would be appreciated.

    Sunday, April 5, 2015 9:54 PM

Answers

    • Check your dependencies in your projects. I understand the project was added to the solution but was it also added to the projects that will be 1. implementing/inheriting types from that project and 2. consuming types from that project
    • Check your name spaces to make sure that the type class1 is not also defined in another namespace in that or even a different project. In that case class1 might not have that property available because its pointing to the wrong type.

    If that does not solve your problem it would be helpful to include.

    • the fully qualified namespaces of the types in your type hierarchy that are giving you the problem
    • the full calling code, the sample above is not correct in syntax.
    • the project dependencies for the code in question and where the types are located in each project

    Mark as answer or vote as helpful if you find it useful | Igor

    Monday, April 6, 2015 12:06 AM