Hello,
I have a class which I am using in my profile.
I made this class Serializable by using:
<Serializable()> _
Public Class Options
One of the properties in this class is of type Level where level is a
structure:
Public Structure Level
Dim Delete As Boolean
Dim Create As Boolean
Dim Update As Boolean
Dim View As Boolean
End Structure ' Level
' Access
Private _Access As Level
Public Property Access() As Level
Get
Return _Access
End Get
Set(ByVal value As Level)
_Access = value
End Set
End Property ' Access
Can I make this?
I am not sure if I can use the structure as described since my class
is Serializable because of profile.
Should I turn Level into a Serializable class to with 4 properties?
Thanks,
Miguel> Public Structure Level
> Dim Delete As Boolean
> Dim Create As Boolean
> Dim Update As Boolean
> Dim View As Boolean
> End Structure ' Level
> Should I turn Level into a Serializable class to with 4 properties?
Why not make it a simple enum with Flags!
<Flags> Public Enum Level
Delete = 1
Create = 2
Update = 4
View = 8
End Enum
IMHO, this would be a better choice for you!
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
---
You can use a structure, certainly. However, private members of classes and
structures are not serialized as XML.
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"shapper" <mdmoura@.gmail.com> wrote in message
news:1182349298.570647.201260@.w5g2000hsg.googlegroups.com...
> Hello,
> I have a class which I am using in my profile.
> I made this class Serializable by using:
> <Serializable()> _
> Public Class Options
> One of the properties in this class is of type Level where level is a
> structure:
> Public Structure Level
> Dim Delete As Boolean
> Dim Create As Boolean
> Dim Update As Boolean
> Dim View As Boolean
> End Structure ' Level
> ' Access
> Private _Access As Level
> Public Property Access() As Level
> Get
> Return _Access
> End Get
> Set(ByVal value As Level)
> _Access = value
> End Set
> End Property ' Access
> Can I make this?
> I am not sure if I can use the structure as described since my class
> is Serializable because of profile.
> Should I turn Level into a Serializable class to with 4 properties?
> Thanks,
> Miguel
>
On Jun 21, 2:11 pm, "Kevin Spencer" <unclechut...@.nothinks.com> wrote:
> You can use a structure, certainly. However, private members of classes an
d
> structures are not serialized as XML.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Printing Components, Email Components,
> FTP Client Classes, Enhanced Data Controls, much more.
> DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net
> "shapper" <mdmo...@.gmail.com> wrote in message
> news:1182349298.570647.201260@.w5g2000hsg.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
Hi,
I am serializing my profile classes as binary:
<add allowAnonymous = "false" name = "Collaborator" type =
"Collaborator" serializeAs = "Binary" />
And my class is as follows (I am using the <flag> enum sugestion from
Gaurav):
<Serializable()> _
Public Class Collaborator
' Permissions
Private _Permissions As Security
Public Property Permissions() As Security
Get
Return _Permissions
End Get
Set(ByVal value As Security)
_Permissions = value
End Set
End Property ' Permissions
' Security
<Serializable()> _
Public Class Security
' Level
<Flags()> Public Enum Level
Delete = 1
Create = 2
Update = 4
View = 8
End Enum ' Level
' Blogger
Private _Blogger As Level
Public Property Blogger() As Level
Get
Return _Blogger
End Get
Set(ByVal value As Level)
_Blogger = value
End Set
End Property ' Blogger
' Scheduler
Private _Scheduler As Level
Public Property Scheduler() As Level
Get
Return _Scheduler
End Get
Set(ByVal value As Level)
_Scheduler = value
End Set
End Property ' Scheduler
..
End Class ' Security
End Class ' Collaborator
Is this ok?
Thanks,
Miguel
Hi Miguel,
> Is this ok?
I do not see any problems.
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
---
Thursday, March 22, 2012
Structure and Class
Labels:
_public,
asp,
class,
net,
optionsone,
serializable,
structure,
usingltserializable
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment