Hello,
I have following example.
public class clsMobileDataSharing
{
public DateTime? EventDate { get; set; }
public string Message { get; set; }
public MobileEventName EventName { get; set; }
public int? AgencyID { get; set; }
public string PersonnelPK { get; set; }
}
[Serializable]
public class clsPoliceDataSharing : clsMobileDataSharing
{
public TempEvents EventNameTemp { get; set; }
}
{
public DateTime? EventDate { get; set; }
public string Message { get; set; }
public MobileEventName EventName { get; set; }
public int? AgencyID { get; set; }
public string PersonnelPK { get; set; }
}
[Serializable]
public class clsPoliceDataSharing : clsMobileDataSharing
{
public TempEvents EventNameTemp { get; set; }
}
When I create object of Child class then it display base class's "EventName" property. I don't want this.
How to hide base class property in child class ?

VulpesPosted Jan 8, 2014, 6:02 AM
However, if you don't want to change the name of the derived class property, then your options are limited.
You could hide the base class's implementation of the EventName with your own. For example:
VulpesPosted Jan 17, 2014, 9:48 AM
I assume that the resulting name clash is what is causing the exception.
If you don't want the base class field to be serialized at all, I'd suggest you make the base class serializable but place the NonSerialized attribute on the field:
Ajay PatelPosted Jan 17, 2014, 5:35 AM
Thanks for your reply and it works for compile time but display runtime error
Member clsJailData.EventName of type XSharingWS.JailEvent hides base class member clsMobileDataSharing.EventName of type XSharingWS.MobileEventName. Use XmlElementAttribute or XmlAttributeAttribute to specify a new name.
here is my code :
public class clsMobileDataSharing
{
public DateTime? EventDate { get; set; }
public string Message { get; set; }
public MobileEventName EventName { get; set; }
public int? CompanyID { get; set; }
public string UserPK { get; set; }
}
[Serializable]
public class clsJailData : clsMobileDataSharing
{
private JailEvent _JailEvent;
new public JailEvent EventName
{
get
{
return _JailEvent;
}
set
{
_JailEvent = value;
}
}
}
Please give me solution why this happen...