I am trying to implement a custom profile class in C# that inherits System.Web.Profile.ProfileBase. I have a few properties of type System.Collections.Generic.List that need to be serialized as binary instead of the default XML. However, I am unsure of how to mark that setting in Profile class.
For instance, I have a property named “SavedReports” that is of type List. If I were to use the web.config approach, i would simply write :
<code>
<profile>
<providers>
<add name="SavedReports" serializeAs="Binary" type="System.Collections.Generic.List`1[MyNamespace.SavedReports]"/>
<code>
However, I am unsure how I would add the serializeAs=”Binary” attribute in C# for the custom implementation:
[SettingsAllowAnonymous(false)]
public List<SavedReport> SavedReports
{
get { return base["SavedReports"] as List<SavedReport>; }
set { base["SavedReport"] = value; }
}
Any help would be great.
Thanks,
Chris
I’ve found this:
SettingsSerializeAsAttribute