Calling a variable from another class

Pretty new to C# so I am learning the basics. One thing I am having trouble with is calling a variable from another class. Trying to set it up so that I can call it from any class. Variable is sConnectionString.

Any ideas on how to do from another class? I tried the sql.password.sConnectionString.toString(); and it failed to even find sql.password.sConnectionString

class sql {

 public static void password() { string connectionString = ConfigurationManager.ConnectionStrings["My_ConnectionString"].ConnectionString; string MyEncryptedPassword = ConfigurationManager.ConnectionStrings["Encrypted_Password"].ConnectionString; string strDecrptedText = decrypt.Decrypt2(MyEncryptedPassword); string sConnectionString = connectionString.Replace("##Password$$", strDecrptedText); } } 

by Coronax16 via /r/csharp

Leave a Reply