Can you save an object to a settings.settings file in Visual Studio? If so how? I think you can make your object serializable and it should persist, but I'm not sure if I'm doing it right i.e. when I try to get the object back it is always null.
Here is the code:
[Serializable()]
[XmlRoot(ElementName = "LayerTCA", IsNullable = false, Namespace = "http://somesite.com")]
public class LayerTCA
{
//This is a COM object so I don't want to serialize this.
IFeatureClass featureClass;
string fullName;
string basicName;
public LayerTCA()
{
}
public LayerTCA(IFeatureClass featureClass)
{
FeatureClass = featureClass;
}
public IFeatureClass FeatureClass
{
get { return featureClass; }
set
{
featureClass = value;
fullName = featureClass.AliasName;
basicName = StringHelper.StringAfterLastFullStop(fullName);
}
}
[XmlAttribute(AttributeName = "BasicName")]
public string BasicName
{
get { return basicName; }
set { basicName = value; }
}
[XmlAttribute(AttributeName = "FullName")]
public string FullName
{
get { return fullName; }
set { fullName = value; }
}
public override string ToString()
{
return FullName;
}
}