A
andyjgw
Hi
I posted this in the caching section, before noticing that it appears
to be a practically dead NG, so please excuse the x-post...
Can anyone advise on this please? Something is happening here and it's
driving me mad trying to work out what. For simplicity I've reduced all
code to a simple section running in my applications' Page_Load method:
(in declarations:
Private svcinfo As New serviceInfo
)
Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Cache.Item("ServiceInfo") Is Nothing Then
svcinfo = svcIMS.getServiceInfo
Cache.Insert("ServiceInfo", svcinfo)
Debug.WriteLine("Envelope in the cache is " &
Cache("ServiceInfo").env.ToString)
Else
' got one already thanks, so reload that.
svcinfo = Cache("ServiceInfo")
End If
cE = svcinfo.env
cE.minx = 10
cE.maxx = 20
cE.miny = 100
cE.maxy = 200
Debug.WriteLine("Changed local cE to be " & cE.ToString)
Debug.WriteLine("Envelope now in the cache is " &
Cache("ServiceInfo").env.ToString)
End Sub
And here's the output I get. The initial load in the cache is the value
I want to preserve, it should never be changed.
Envelope in the cache is SW: 166000,828000 : NE 232000,921000
Changed local cE to be SW: 10,100 : NE 20,200
Envelope now in the cache is SW: 10,100 : NE 20,200
The toString function for an Envelope is:
Overrides Function toString() As String
Return String.Format("SW: {0},{1} : NE {2},{3}", _minx, _miny,
_maxx, _maxy)
End Function
How come I have a local copy of what is in the cache (in cE) yet when I
change cE it affects what's in the cache? I don't get it...
Someone put me out of my misery please
Cheers
AW
I posted this in the caching section, before noticing that it appears
to be a practically dead NG, so please excuse the x-post...
Can anyone advise on this please? Something is happening here and it's
driving me mad trying to work out what. For simplicity I've reduced all
code to a simple section running in my applications' Page_Load method:
(in declarations:
Private svcinfo As New serviceInfo
)
Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Cache.Item("ServiceInfo") Is Nothing Then
svcinfo = svcIMS.getServiceInfo
Cache.Insert("ServiceInfo", svcinfo)
Debug.WriteLine("Envelope in the cache is " &
Cache("ServiceInfo").env.ToString)
Else
' got one already thanks, so reload that.
svcinfo = Cache("ServiceInfo")
End If
cE = svcinfo.env
cE.minx = 10
cE.maxx = 20
cE.miny = 100
cE.maxy = 200
Debug.WriteLine("Changed local cE to be " & cE.ToString)
Debug.WriteLine("Envelope now in the cache is " &
Cache("ServiceInfo").env.ToString)
End Sub
And here's the output I get. The initial load in the cache is the value
I want to preserve, it should never be changed.
Envelope in the cache is SW: 166000,828000 : NE 232000,921000
Changed local cE to be SW: 10,100 : NE 20,200
Envelope now in the cache is SW: 10,100 : NE 20,200
The toString function for an Envelope is:
Overrides Function toString() As String
Return String.Format("SW: {0},{1} : NE {2},{3}", _minx, _miny,
_maxx, _maxy)
End Function
How come I have a local copy of what is in the cache (in cE) yet when I
change cE it affects what's in the cache? I don't get it...
Someone put me out of my misery please
Cheers
AW