Category Archives: C# Development
Entity- Basic Query
A basic entity query for a data grid.
|
1 2 3 |
Grid.DataSource = (from status in MyQuery orderby status.ServiceObjectStatus select status.ServiceObjectStatus).ToList(); |
Posted in C# Development
Comments Off on Entity- Basic Query
Write String to File
This example writes the contents of a string to a text file.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); StringBuilder sb = new StringBuilder(); foreach (string txtName in Directory.EnumerateFiles(mydocpath,"*.txt")) { using (StreamReader sr = new StreamReader(txtName)) { sb.AppendLine(txtName.ToString()); sb.AppendLine("= = = = = ="); sb.Append(sr.ReadToEnd()); sb.AppendLine(); sb.AppendLine(); } } using (StreamWriter outfile = new StreamWriter(mydocpath + @"\AllTxtFiles.txt")) { outfile.Write(sb.ToString()); } |
Posted in C# Development
Comments Off on Write String to File