/// <summary> /// Reads a character from the console component /// </summary> /// <returns>The character read</returns> public char Read() { Reading = true; KeyMan.Focus(this); while (Reading) { ; //Wait for user to enter input } KeyMan.Unfocus(); return((char)In.Read()); }
/// <summary> /// 将后面size字节的数据拷贝到st中 /// </summary> /// <param name="st"></param> /// <param name="size"></param> public void CopyTo(StreamTool st, int size, byte[] swap) { var total = size; var batchN = swap.Length; while (total > 0) { var step = total > batchN ? batchN : total; In.Read(swap, 0, step); st.Out.Write(swap, 0, step); total -= step; } }
static int Int() { var n = 0; while (true) { var c = In.Read() - '0'; if (0 <= c) { n = 10 * n + c; } else { return(n); } } }
/// <include file='doc\Console.uex' path='docs/doc[@for="Console.Read"]/*' /> public static int Read() { try { return(In.Read()); } catch (IOException e) { // Assume that this happened because In was an invalid handle. if (Marshal.GetHRForException(e) == Win32Native.MakeHRFromErrorCode(Win32Native.ERROR_INVALID_HANDLE)) { // Set in to something that will give us EOF semantics. _in = TextReader.Synchronized(StreamReader.Null); } else { throw; } } return(-1); }
static void Main(string[] args) { OutputEncoding = GetEncoding("UTF-8"); WriteLine("Hello World!"); WriteLine(ReadName() + "\n"); DateTime localDate = DateTime.Now; DateTime utcDate = DateTime.UtcNow; String[] cultureNames = { "pl-PL", "en-US", "en-GB", "pt-PT", "de-AT", "ru-RU" }; foreach (var cultureName in cultureNames) { var culture = new CultureInfo(cultureName); WriteLine("{0}", culture.NativeName); WriteLine(" Local date and time {0}, {1:G}", localDate.ToString(culture), localDate.Kind); WriteLine(" UTC date and time: {0}, {1:G}\n", utcDate.ToString(culture), utcDate.Kind); } In.Read(); }
protected void CharInput(int lineno) { CheckNullCharacter(lineno); SecondPerson.Value = In.Read(); }
public static int Read() { return(In.Read()); }
// Read a character from the standard input stream. public static int Read() { NormalMode(); return(In.Read()); }
public virtual int Read() => In.Read();
public static int Read() { return In.Read(); }