Using and enviroment.newline

xiaoxiao2021-03-06  67

Using Statement:

Not the kind of things that are similar to #include or import, but to release unmanaged resources, all Class of IDisposable can be used, such as file operations:

USING (streamreader sr = new streamreader ("sample.txt")) {strcontent = sr.readtoend ();}

This is equivalent:

StreamReader SR = New StreamReader ("Sample.txt"); try {strand ();} catch () {// ...} finally {sr.dispose (); // it Equvalent to sr.close ();

The other is end of line, usually we use / n instead, but this is not good, for versatility, we should use

Environment.newline in Java, is: System.GetProperty ("line.separator")

转载请注明原文地址:https://www.9cbs.com/read-110548.html

New Post(0)