C # What is the difference between console. Write and console. writeline ????

Source: Internet
Author: User
Both write () and writeline () are system. the methods provided by the console are mainly used to display the output stream by the specified output device (the screen by default. the difference between the two lies in the console. the writeline () method outputs the string to be output along with the line feed control character. When the statement is executed, the cursor moves to the next line of the current output string. as for console. in the write () method, the cursor stops at the last character of the output string and does not move to the next line.
For example, console. writeline ("A"); console. writeline ("B") will output a B in two rows and console. write ("A"); console. write ("B") Outputs a B in the same row.



Stream and byte reading problems:
Mmstream. Read (Byte[] Buffer, offset, count)

Among them, mmstream is a stream object of the memorystream class. Among the three parameters, buffer contains the specified byte array, which ranges from offset to (Offset + count-1) the value is replaced by the characters read in the current stream. Offset refers to the byte offset in the buffer, which is read from this point. Count refers to the maximum number of bytes read. The write () method and read () method have the same parameter type.

 

2,

What is the difference between memorystream. Position and memorystream. Seek?

Both of them obtain or set the current position in the stream. It seems that the seek function completely covers the position function. What should postion do?

------ Solution ----------------------
No!

I asked u, if you do not know the file stream length, or you do not care about the file stream length, you only need to take the Fifth byte to the last. How do you specify the position? The seek method and seekorigin enumeration are required. Besides, position is also responsible for obtaining the current position. 3. C # stream reading (conversion)

A stream has three basic operations: writing, reading, and searching.

If data is transmitted from the memory buffer to the external source, such a stream is called "Write stream ".

If data is transmitted from an external source to the memory buffer, such a stream is called "read stream ".

 

// Initialize a cache Zone      byte [] buffer =  new  byte [BufferLen];      int  read = 0;      int  block;

C # What is the difference between console. Write and console. writeline ????

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.