GetString() public method

public GetString ( string name ) : LocString
name string
return LocString
コード例 #1
0
ファイル: Tests.cs プロジェクト: petergolde/PurplePen
        public void WriteResources()
        {
            string filename = GetTestFile("AboutForm.resx");
            ResXFile resXFile = new ResXFile(filename, new CultureInfo("fr"));
            resXFile.Read();

            LocString str = resXFile.GetString("label1.Text");
            str.Localized = "Foo";
            resXFile.Write();

            resXFile = new ResXFile(filename, new CultureInfo("fr"));
            resXFile.Read();

            ICollection<LocString> strings = resXFile.AllStrings;

            foreach (LocString locstr in strings) {
                Console.WriteLine("Name:{0}    NonLocValue:{1}   LocValue:{2}   Comment:{3}", locstr.Name, locstr.NonLocalized, locstr.Localized, locstr.Comment);
            }
        }