Reputation: 793
I'm sorry I'm new to C# and WPF.
namespace MyProgram
{
/// <summary>
/// Description of TSearchFiles.
/// </summary>
public class TSearchFiles
{
private TBoolWrapper canceled;
public TSearchFiles(TBoolWrapper bw)
{
canceled = bw;
}
public List<TPhotoRecord> GetFilesRecursive(string b)
{
List<TPhotoRecord> result = new List<TPhotoRecord>();
return result;
}
}
}
I got this error message:
Error 1 Inconsistent accessibility: return type 'System.Collections.Generic.List<MyProgram.TPhotoRecord>' is less accessible than method 'MyProgram.TSearchFiles.GetFilesRecursive(string)'
How to fix it? The code compiled fine in Winforms
Thanks in advance.
Upvotes: 3
Views: 5585
Reputation: 508
Your TPhotoRecord
class is private, so you can't talk about it in a return type of a public method.
Upvotes: 0
Reputation: 111
Your class TPhotoRecord
should be public because the method public List<TPhotoRecord> GetFilesRecursive(string b)
is public.
Upvotes: 2
Reputation: 18543
Probably TPhotoRecord
class is private
, i.e.
private class TPhotoRecord
{
//...
}
As far as you return a List<TPhotoRecord>
in a public method of a public class:
public class TSearchFiles
{
//...
public List<TPhotoRecord> GetFilesRecursive(string b){/*...*/}
}
TPhotoRecord
cannot be less accessible, i.e. it also should be public.
Upvotes: 8