Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
No Overload takes 5 arguments
Message
De
22/09/2013 05:30:32
 
 
À
21/09/2013 13:42:00
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01583574
Message ID:
01583830
Vues:
41
On an afterthought

>>And if you use 'ref' you are forced to instantiate the objects before the call otherwise it won't compile ; 'out' avoids that....

Nowhere is it written that you have to instantiate the objects before the call - only that they have to be initialized

A null value is ok
	static class Test_RefOut
	{
		internal static void Go()
		{
			Dictionary<string, string> dict = null;

			int x = GetDictByRef(ref dict);

			Console.WriteLine("result : {0}", dict);
		}

		static int  GetDictByRef(ref Dictionary<string, string> dict)
		{
			//dict = new Dictionary<string, string>();
			return 2;
		}
		
	}
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform