How to declare explicit a member of a interface?.i.e:
public interface IPerfil
{
int IDPerfil
{
get;
set;
}
int IDMarca
{
get;
set;
}
int IDRegional
{
get;
set;
}
int IDFilial
{
get;
set;
}
}
then
public class ComentariosPerfil : BaseComentarios, IPerfil
{
public int IPerfil.IDFilial
{
get;
set;
}
[...]
I get an compilation error,saying that "public" modifier cannot be applied to this item.
The question is:
I want this property to be public. I can't write modifiers in interface like:
public int IDPerfil
{
get;
set;
}
So,how can I explicitly implement an interface member, and make it Public?
For explicitly implemented interfaces you can't specify the visibility. It is taken from the visibility in the interface's definition.
So in your case use the following. The function will be public because that's the way the IPerfil interface is defined:
public class ComentariosPerfil : BaseComentarios, IPerfil
{
int IPerfil.IDFilial
{
get;
set;
}
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