Hi. I am trying to do something that seems very simple. I want to create a
class that inherits from the ListViewItem Control so that I can add a few
custom properties to it. I then want to make it serializable so that I can
save the ListViewItems contained in the ListView. My code snippet is this:
[Serializable()]
public class test : System.Windows.Forms.ListViewItem
{
public test(string s, int i): base(s, i) {}
protected test(SerializationInfo si, StreamingContext context)
: base(si,context){}
//additional properties here.
}
When attempting to compile I get the error message:
....\MainForm.cs(1077):
'System.Windows.Forms.ListViewItem.ListViewItem(Sy stem.Runtime.Serialization.SerializationInfo,
System.Runtime.Serialization.StreamingContext)' is inaccessible due to its
protection level
I added the second constructor
"protected test(SerializationInfo si, StreamingContext context)
: base(si,context){}"
in an attempt to fix a problem that was occuring during runtime. I was
getting an exception error that the class could not be deserialized.
Thanks for the help in advance.