c# - Inconsistent accessibility less accessible -


i've searched answers on similar errors, haven't been able find any. know how fix error (make public - don't want do), don't understand why not allowed. anyway - i'm getting

inconsistent accessibility: property type 'e7xlibrary.base.multisegmentbase' less accessible property 'e7xlibrary.e7xgroupbase.groupsegment'

my multisegmentbase class declared internal class (and segmentbase class):

internal class multisegmentbase : segmentbase 

i’m using multisegmentbase instance protected abstract property in public e7xgroupbase class:

public abstract class e7xgroupbase {     internal abstract uint64 length { get; }     protected abstract multisegmentbase groupsegment { get; }      internal virtual void wrap(binarywriter writer)     {         groupsegment.length = this.length;         groupsegment.wrap(writer);     } } 

and lastly have devided public class e7xsessiongroup class implements abstract e7xgroupbase, this

public class e7xsessiongroup : e7xgroupbase {     #region properties     private sessiongroupsegment _groupsegment = null;     protected override multisegmentbase groupsegment     {                 {             if (_groupsegment == null)                 _groupsegment = new sessiongroupsegment();             return _groupsegment;         }     } 

as said, know if declare multisegmentbase public class instead of internal, wouldn’t have error, since i’m making api don’t want expose multisegmentbase , further classes derive from multisegmentbase.

basically, quistion why multisegmentbase needs accessible e7xgroupbase , e7xsessiongroup, when use multisegmentbase in protected property? , of have workaround?

the problem have public class pubic property internal class:

public abstract class e7xgroupbase {     protected abstract multisegmentbase groupsegment { get; } } 

the e7xgroupbase can extended class in different assembly (since it's public) extending class couldn't resolve multisegmentbase class because defined internal.

this may explain:

assembly 1:

public abstract class e7xgroupbase internal class multisegmentbase : segmentbase 

assembly 2:

public class : e7xgroupbase {     // can't resolve type multisegmentbase  } 

you either need make multisegmentbase public, or create public interface , use in e7xgroupbase:

public interface imultisegmentbase { }  internal class multisegmentbase : imultisegmentbase {}  public abstract class e7xgroupbase {     protected abstract imultisegmentbase groupsegment { get; } } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -