Arthur Mamou-Mani
Arthur Mamou-Mani

Reputation: 2333

Error (CS1061): 'System.Collections.Generic.List<Rhino.Geometry.Brep>' does not contain a definition for

I get the following error message when running the script below, I looked at the example in the documentation but cannot figure out what is wrong:

Error (CS1061): 'System.Collections.Generic.List<Rhino.Geometry.Brep>' does not contain a definition for 'GetArea' and no extension method 'GetArea' accepting a first argument of type 'System.Collections.Generic.List<Rhino.Geometry.Brep>' could be found (are you missing a using directive or an assembly reference?)

Code:

  private void RunScript(List<Brep> x, ref object A)
  {
    A = x.GetArea();
  }

Upvotes: 0

Views: 1121

Answers (1)

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73442

Yes, you're calling GetArea on List<T>. That's why compiler throws error.

Did you mean something like this ?

A = x[0].GetArea();//get area of first element

Note 0 is just a index, it can be any variable number.

Upvotes: 1

Related Questions