if i have a protected method, can i pass in a parameter where the data type is declared internal?
No, unless the type (with the protected member) is itself internal. Internal types cannot be part of a public/protected API, as the consumer would have no way of using it.
You could, however, consider using a public interface to abstract the type - i.e.
public interface IFoo {}
internal class Foo : IFoo {}
public class Bar {
protected void Test(IFoo foo) {}
}
Generics can be useful for this too:
protected void Test<T>(T foo) where T : IFoo { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With