Click here to Skip to main content
15,906,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have develop win form application .this application have 2 errors
like

" Inconsistent accessibility: return type 'System.Collections.Generic.List<pdf_clustering.lib.center>' is less accessible than method 'Pdf_Clustering.Lib.FileClustering.prepareCluster(int, System.Collections.Generic.List<pdf_clustering.lib.fileinfo>, ref int)' "

another error like as

" Inconsistent accessibility: parameter type 'System.Collections.Generic.List<pdf_clustering.lib.fileinfo>' is less accessible than method 'Pdf_Clustering.Lib.FileClustering.prepareCluster(int, System.Collections.Generic.List<pdf_clustering.lib.fileinfo>, ref int)' "

my code like as:

center propert class:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pdf_Clustering.Lib
{
    class center
    {
        public List<Fileinfo> FileGroup { get; set; }
    }
}


FileClustering like as:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pdf_Clustering.Lib
{
   public static class FileClustering
    {
        private static int Gcounter=0;
        private static int counter;
    public static List<center> prepareCluster(int k, List<Fileinfo> fCollection, ref int _counter)
        {
            Cluster_process cp = new Cluster_process();
            Gcounter = 0;
            List<center> Ccollection = new List<center>();
            center point;
       
            HashSet<int> uniqRand = new HashSet<int>();
            Randomnumber_generation(ref uniqRand, k, fCollection.Count);
            
            foreach(int pos in uniqRand) 
            {
                point = new center();
                point.FileGroup = new List<Fileinfo>();
                point.FileGroup.Add(fCollection[pos]);
                Ccollection.Add(point);            
            }

            Boolean stoppingCriteria;
            List<center> Finalset;
            List<center> BeforeClusterCenter;

            InitializeClusterCenter(out Finalset, Ccollection.Count);

            do
            {
                BeforeClusterCenter = Ccollection;

                foreach (Fileinfo fi in fCollection)
                {
                   
                    int index = cp.ClosestClusterCenter(Ccollection, fi);
                    //int index =  cp.ClosestClusterCenter(Ccollection,fi);
                    Finalset[index].FileGroup.Add(fi);
                }
                InitializeClusterCenter(out Ccollection, Ccollection.Count());
                Ccollection = cp.Meancalculation(Finalset);
              //  Ccollection = cp.Meancalculation(Finalset);
                stoppingCriteria = CheckStoppingCriteria(BeforeClusterCenter, Ccollection);
                if (!stoppingCriteria)
                {   
                    
                    InitializeClusterCenter(out Finalset, Ccollection.Count);
                }


            } while (stoppingCriteria == false);

            _counter = counter;
            return Finalset;

        }


Filinfo propert class

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pdf_Clustering.Lib
{
    class Fileinfo
    {
        public long Fsize { get; set; }
        public string Fname { get; set;}
        public string Ffullname { get; set;}
        public string Fextension { get; set; }
        public string content { get; set; }
        public float[] Fspace { get; set; }
    }
}


please help me for solving
Posted
Comments
_Asif_ 10-Feb-15 7:53am    
Try marking both center and FileInfo class as public and check again

1 solution

Your Fileinfo class does not have any accessibility defined ; so its default accessibility is set to internal. That means that this class is usable only from the library (or the executable) that defines it. You cannot use this class from a foreign assembly.

So when you set it as a parameter in the prepareCluster method, which is defined as public, the compiler warns you about the fact that, despite the method being public, you won't be able to use it from a foreign assembly as one of the parameters is of an internal type, which will not be accessible.

Solution : mark your Fileinfo class as public:
C#
public class Fileinfo
{
   //...
}

Compiler should not complain after that. Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900