string name = "Rajesh"; int char_count = name.Length; MessageBox.Show(char_count.ToString());
public enum DB_Mode { New, Edit, Update }; string mode_value = Enum.GetName(typeof(DB_Mode), DB_Mode.New); MessageBox.Show(mode_value);
Public Static class projects { public static int project_id; public static Get_Project_Details(int project_id) { } }
Class_name.Method_name(); Class_name.Variable_name();
public static class static_class { public static string status;//Static variable public static void print() //static method { } } public class non_static_class { //we must not need to create object of static_class string Status = static_class.status; static_class.print(); }
StreamReader sr = new StreamReader("path of the file");
using System.IO; string file_contents; using (StreamReader sr = new StreamReader("C:\\rpt.txt")) { file_contents = sr.ReadLine(); } if (!String.IsNullOrEmpty(file_contents)) { MessageBox.Show(file_contents); }
string file_contents; ArrayList arr_list = new ArrayList(); using (StreamReader sr = new StreamReader("C:\\rpt.txt")) { while ((file_contents = sr.ReadLine()) != null) { arr_list.Add(file_contents); } }
string file_contents; using (StreamReader sr = new StreamReader("C:\\rpt.txt")) { file_contents = sr.ReadToEnd(); sr.Close(); }