asp.net - Differences between getting a value in a class with instance constructors and a class filled with const fields -
I have an example project that is a config class that I need to set my ID and key.
public class configuration {#region Fields Private Static string partner = ""; Private static string key = ""; #endregion constantconfig () {// ???? Line Line Line Line Line Line Line Line Line ????a???? Configure your identity ?? Line Line Line Formula ??? // affiliate (starts with issue 2088) partner = ""; // Extra Code Key = ""; // One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ?? ?? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ?? ?? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ???? One ???? } #region Properties Public Static String Partner {Get {Return Partner; } Set {partner = value; }} Public Stable String Key {Received {Return Key; } Set {key = value; So} the methods in the second category can get my ID and key like ¼ ?? string _partner = Config.Partner.Trim (); String _key = Config.Key.Trim (); Public questions bool Verify (SortedDictionary & lt; string, string & gt; inputPara, string notify_id, string _partner, string _key) {// ...} My question is, If I change Config.cs as : public class test config {public key string partner = ""; // Configure your companion IDC public const string key = ""; // Configure Your Key} Since my key ID is not altered, the key never changes, and they only need to be compiled in the beginning so that this method in another class The value to get both of these Calling Conf. K. trim (), the results are the same, why not use the category filled with the cool field like I write?
No matter
debugging both cases Try, you think variables are set in almost the same way.
Comments
Post a Comment