I am getting an error, Inconsistent accessibility: return type " " is less accessible than " ".

Not sure what is going on, I would appreciate some help

public List<point2d> get_myList(ReturnData3 rd)
        {
            
            List<point2d> points = new List<point2d>();          

            List<double> x = rd.X3;
            List<double> y = rd.Y3;

            int h = rd.CounT;

            for (int i = 0; i < h; i++)
            {
                points.Add(new point2d(x[i], y[i]));                
            }
            return points;
        }        
        //
        //
        //bubble sort
        //
        //                                                                   
      public List<point2d> sortPoint(ReturnData3 rd, XY p,List<point2d> k) //sorts array, bubble sort method, least to greatest
        {
            
           
            List<point2d> sort = new List<point2d>();
            bool flag = true;
            int size = rd.CounT - 1;
            
           
            
            while (flag)
            {
                int h = 1;
                flag = false; //set flag to false, start loop                  
                for (int i = 0; i < size; i++)
                {
                    if ( k[h].x < k[i].x) //gets second x and compares it to the first x 
                    {
                        double temp_x = k[i].x;
                        double temp_y = k[i].y;   //keeping (x,y) together

                        k[i].x = k[h].x; //changes x (main sort)
                        k[i].y = k[h].y; //changes y 

                        k[h].x = temp_x;
                        k[h].y = temp_y;
                        flag = true;    //made the swap

                        sort.Add(new point2d(temp_x,temp_y)); //stores into new list (sort(x,y))
                    }

                    sort.Add(new point2d(k[i].x, k[i].y)); //stores if already in the right spot
                    size--;
                }
                
            }
            return sort; //trying to return sorted mylist
        }

Recommended Answers

All 2 Replies

Is the class this is in public?

Hi coffeeMan21,

How is "point2d" declared? Is it public or internal?

You are getting the error because you are making a public method, but the type that it returns is most likely not public. Example:

public class Honda
{
    // This accessory is private and only for use by the Honda class
    private struct HondaAccessory
    {
       ...
    }

    ...
    // But this method is public. Others can't see the return type
    // If other classes can't see HondaAccessory, how can they call this method?
    public HondaAccessory GetAccessory() { ... }

}

But that's just a guess -- make sure your point2d definition is public or make your methods as restrictive or more restrictive than your point2d definition.


Hope this helps,

Vasiliy Deych

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.