I have to store some templates based on the statecode.I cannot store them in database. So i thought of creating a dictionary with statecode as key and list as value. I have chosen a list because i need a template line by line.So each string in list is a line. Is there any better way of dealing with this kind of situation. Please comment.
private static readonly Dictionary<string, List<string>> NotaryForStates = new Dictionary<string, List<string>>()
{
{"AR",new List<string> {"Per Steve Hollowell, ESQ from the Legal Division of the AR, SOS. Telephone number for the Legal Division of the SOS: (501)-682-3012. Arkansas Code 16-47-101.", "State of Arkansas", "County of <notary county>","On this day, <sign date> before me, <name of notary>, the undersigned notary, personally appeared, <name of signer> who acknowledged he/she is the <title of signer> of <name of company> and that he/she as such <title of signer>, being authorized so to do, executed the foregoing instrument for the purposes therein contained, by signing the name of the corporation by himself/herself as <title of signer>.","In witness whereof I hereunto set my hand and official seal.","______________________","Notary Public","<Notary name>","My Commission expires: <notary commission date>"}},
{"CA",new List<string>{"State of California","County of <Notary County>","On <sign date> before me, <Notary Name>, Notary Public, personally appeared <Signing Party Name>, who proved to me on the basis of satisfactory evidence to be the person(s) whose name is subscribed to the within instrument and acknowledged to me that he/she executed the same in his/her authorized capacity, and that by his/her signature on the instrument the person, or the entity upon behalf of which the person acted, exec开发者_JAVA百科uted the instrument.","I certify under PENALTY OF PERJURY under the laws of the State of California that the foregoing paragraph is true and correct.","WITNESS my hand and official seal.","______________________________","Notary Public: «NotaryName»","My Comm. Expires: «NotaryCommExp»"}},
{"FL",new List<string>{"State of Florida","County of <Notary County>","On <sign date> before me, the undersigned, a Notary Public, for said County and State, personally appeared <Signing Party Name>, personally known to me to be the person that executed the foregoing instrument and acknowledged that is a <signer title> of <name of company> and that he/she did execute the foregoing instrument. <Name of Signer> is personally known to me.","_____________________","Notary Public: «NotaryName»","My Comm. Expires: «NotaryCommExp»"}}
};
First alternative: You may use a simple string instead of a list and separate the individual lines with Environment.NewLine
("\n"). You can create such strings easily with a StringBuilder
object and split it again (if you need to) with the string.Split()
method. This is also (slightly) faster than the List<string>
approach.
Second alternative: You may use files and store only the filename in your dictionary.
Whether or not one of the above options is a better alternative to your original approach, depends on the concrete project you're working on. All in all, the List<string>
approach might well be ok...
HTH!
Another alternative is to use resource files (which are commonly used for localization). Resource files provide a location for storing text or other types of objects which can be used across a Web site, WPF or Windows Forms application, thus creating a central location for maintaining the text. Using resource files can also simplify maintenance of your application.
精彩评论