[Mono-aspnet-list] Difference between Mono and .NET in private properties and methods
kalevipoeg at starline.ee
Tue Jul 28 06:08:50 EDT 2009
I know this topic sounds weird cause private is a private and Mono shouldn't
follow the Microsoft's way to name private methods and properties cause they
"are not supposed to be exposed" to public. But as we all know we can get
this by means of reflection.
Latelly I spent a few hours debugging my application which worked great on
windows but failed on linux/mono. The reason was that I was using private
property "ClientState" through reflection in PageStatePersister inherited
class to init "__VIEWSTATE" hidden field. Of cause this property was missing
in Mono and instead it has "RawViewState" property which does the same.
In most case You should touch private properties and methods, but sometimes
to make such little hacks is the only way to go, like in the case when You
want override the contents of "__VIEWSTATE" hidden field.
delegate void SetClientStateDelegate(Page p, string value);
private static readonly string ClientStateProperty =
static readonly SetClientStateDelegate SetClientState =
BindingFlags.Instance | BindingFlags.NonPublic).GetSetMethod(true)) as
public override void Save()
string myViewStateID = new Guid().ToString("N") +
It could be great to have some comparision table for Mono vs .Net private
properties, methods for such scenarios. I guess there are a lot of people
around here who would be interested.
View this message in context: http://www.nabble.com/Difference-between-Mono-and-.NET-in-private-properties-and-methods-tp24696332p24696332.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.
More information about the Mono-aspnet-list