Another ... unavailable due to its level of protection ... question

Sorry if this exists somewhere in other questions asked about this error, but I looked through TONS and I'm still thrown. So I'm getting old "error unavailable due to security level error". When this error appears, another error occurs, which, in my opinion, is a real problem. I get that "SS.Spreadsheet" does not have any specific constructors, which means that I'm probably not properly implementing my constructor inherited from an abstract class. Or something like that.

public abstract class AbstractSpreadsheet { public Func<string, bool> IsValid { get; protected set; } public Func<string, string> Normalize { get; protected set; } public string Version { get; protected set; } public AbstractSpreadsheet(Func<string, bool> isValid, Func<string, string> normalize, string version) { this.IsValid = isValid; this.Normalize = normalize; this.Version = version; } ... } 

My class:

 class Spreadsheet : AbstractSpreadsheet { public Spreadsheet() : base(v => true, s => s, "default") { } ... } 

I also tried something like:

  public Spreadsheet() : base(v => true, s => s, "default") { IsValid = v => true; Normalize = s => s; Version = "default"; } 

Based on the answers I saw here. But still, nothing (and, given my understanding, it still wonโ€™t work).

An abstract class was provided to me and cannot be changed.

Do I need to implement IsValid, Normalize, and Version style methods in the Spreadsheet class? Or something like that .... If so, how?

I am still new to the programming world and very new to C #, so if someone could even give me a push in the right direction, I would really appreciate it.

+4
source share
3 answers

Since everything in your example is public, the error probably applies to the class itself. Try making the table class public and see if it fixes the error.

+2
source

Try declaring Spreadsheet public:

 public class Spreadsheet : AbstractSpreadsheet { ... } 

You do not need to install IsValid , Normalise or Version in your constructor.

+1
source
 public class Spreadsheet : AbstractSpreadsheet { public Spreadsheet() : base(v => true, s => s, "default") { } } 

Make the Spreadsheet class public

+1
source

Source: https://habr.com/ru/post/1441185/


All Articles