Click to See Complete Forum and Search --> : how many instance will a shared variable be created? just 1 correct?


doglin82
April 7th, 2010, 05:05 PM
Hi :
How many instances of a shared variable will be created in a class? just one? correct

Public Class DocumentDelivery
Implements IDisposable

'A rendered list that contains the rendered documents
Public Shared RenderList As List(Of Byte()())

End Class


So, in other words, the DocumentDelivery class will only have one instance of RenderList, correct? can somebody confirm?

Cimperiali
April 7th, 2010, 05:54 PM
correct. And all instances of DocumentDelivery (if any) would share it, as any piece of code that can access it through DocumentDelivery (class itself).
Beware of multithreading on a multiprocessor machine, though: it might ruin your day...

doglin82
April 7th, 2010, 09:12 PM
why? if I never intend for this to run in a multi threaded environment...

Cimperiali
April 8th, 2010, 02:02 AM
then you should have no matters.