FORUM Tom's Hardware » Programmation » PHP & MySQL & ASP » [ASP.NET][C#]DllImport problème de type const
 

[ASP.NET][C#]DllImport problème de type const

Il y a 405 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici
Ajouter une réponse



 Mot :   Pseudo :  
 
Bas de page
Auteur
 Sujet : [ASP.NET][C#]DllImport problème de type const
 
Plus d'informations

hello
j ai un [DllImport("C://Dll//msfdll.dll" )] vers une dll dans mon projet le problème c'est que DllImport() n'accepte qu'un const string et donc si je veux metter le chemin dans le web.config il est en string tout court.
j ai testé dans mon code d'aller chercher le path dans le

Code :
  1. const string msfdllPath = System.Configuration.ConfigurationManager.AppSettings["msfdllPath"] ;
  2. [DllImport(msfdllPath)]



mais bien sûr ce que je retire du web.config file est un string et donc ça ne passe pas...
je ne sais pas si il y à moyen de déclarer le type const dans le fichier web.config.

est-ce que quelqu'un aurait une solution à apporter?

Profil : Pointeur
Plus d'informations

il y a pas de casting en C# ?

Plus d'informations

un casting de String vers const string ?
Si oui j'aimerai bien savoir comment car à ma connaissance ce n'est pas possible

Profil : Pointeur
Plus d'informations

en c++ il y a le const_cast
AMHA doit y avoir l'equivalent en c#


Aller à :
Ajouter une réponse
  FORUM Tom's Hardware » Programmation » PHP & MySQL & ASP » [ASP.NET][C#]DllImport problème de type const
 

Annonces Google
Publicité