What if the class is public , but the parameter passed to it must be internal ?

A simple reproducible example:

 public abstract class TypeData { // абстрактный класс } public class TypeData<T> : TypeData { // реализация класса } 

Next, we define the internal type:

 internal delegate void SomeDelegate(int a, string b); 

After that we will try to use it in a public class:

 public class TypeDataDelegateContain : TypeData<SomeDelegate> { // реализация дополнительного функционала класса } 

What we get from this is nothing good except a compilation error:

Availability inconsistency: The availability of the TypeData base class is lower than the availability of the TypeDataDelegateContain class.

Can this be avoided without disclosing an internal delegate?

  • You generally have such internal delegate void SomeDelegate(int a, string b); no delegate needed because There is already a ready-to-use Action<int, string> . - Bulson 8:33
  • @Bulson: Will not work, delegates make calls to unmanaged code, and are marked with unsafe as well as partially working with pointers, well, apart from that there is an agreement on calls. - LLENN
  • @LLENN in your case is impossible, since you also use it as a generic for an open class. And what is the meaning of this concealment? - Alexander
  • No Why a delegate? As already written in the comments there is Action. - LiptonDev pm
  • 2
    It is impossible of course, and this is logical. Where SomeDelegate client SomeDelegate copy of SomeDelegate ? There is a solution - instead of a delegate, get an abstract class with a method and use it already as a generic parameter, well, and then make an internal-inheritor of this class. - Andrei NOP

0