Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conversion from C# to VB.NET
Message
De
17/04/2013 13:33:09
 
 
À
17/04/2013 13:18:17
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01571173
Message ID:
01571248
Vues:
48
>>(1) Are we only talking about the App.oApp.Tables
>
>In the same, following the NameObjectCollectionBase objects, I have:
>
>App.oApp.Countries
>App.oApp.Messages
>App.oApp.Provinces
>App.oApp.Tables
>
>I have a NameObjectCollectionBase for Fields as well but this one falls under App.oApp.Tables("TableNameHere").Fields. But, I do not think this would be of any impact here.
>
>>(2) Is App.oApp reinitialized on occasion or not
>
>App.oApp does not get reinitialized once it is initialized at first. Some properties of it might be changed but this is not a factor.


Have you tried using a lock ?

In the code below, anyone accessing Tables will block if Tables is being reinitialized
	public class AClass
	{
		private Dictionary<string, string> Tables_;
		private object TableLocker = new Object();


		public Dictionary<string, string> Tables
		{
			get 
			{
				lock (TableLocker)
				{
					return Tables_;
				}
			}
			private set
			{
					Tables_ = value;
			}
		}

		public void ReInitalizeTables()
		{
			lock (TableLocker)
			{
				Tables_ = new Dictionary<string, string>();
				Tables_.Add("1", "one");
				Tables_.Add("2", "two");
			}
		}
	}
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform