@@ -47,11 +47,7 @@ static async Task UploadFileAsync()
4747 // ASCII for "HelloWorld"
4848 byte [ ] bytes = { 72 , 101 , 108 , 108 , 111 , 87 , 111 , 114 , 108 , 100 } ;
4949
50- for ( int i = 0 ; i < 5 ; i ++ )
51- {
52- await uploader . WriteAsync ( bytes , 0 , bytes . Length ) ;
53- }
54-
50+ await uploader . WriteAsync ( bytes , 0 , bytes . Length ) ;
5551 await uploader . CloseAsync ( ) ;
5652 }
5753 // end-open-upload-stream-async
@@ -73,11 +69,7 @@ static void UploadFile()
7369 // ASCII for "HelloWorld"
7470 byte [ ] bytes = { 72 , 101 , 108 , 108 , 111 , 87 , 111 , 114 , 108 , 100 } ;
7571
76- for ( int i = 0 ; i < 5 ; i ++ )
77- {
78- uploader . Write ( bytes , 0 , bytes . Length ) ;
79- }
80-
72+ uploader . Write ( bytes , 0 , bytes . Length ) ;
8173 uploader . Close ( ) ;
8274 }
8375 // end-open-upload-stream
@@ -104,11 +96,7 @@ static async Task UploadFileWithOptionsAsync()
10496 // ASCII for "HelloWorld"
10597 byte [ ] bytes = { 72 , 101 , 108 , 108 , 111 , 87 , 111 , 114 , 108 , 100 } ;
10698
107- for ( int i = 0 ; i < 5 ; i ++ )
108- {
109- await uploader . WriteAsync ( bytes , 0 , bytes . Length ) ;
110- }
111-
99+ await uploader . WriteAsync ( bytes , 0 , bytes . Length ) ;
112100 await uploader . CloseAsync ( ) ;
113101 }
114102 // end-open-upload-stream-with-options-async
@@ -135,11 +123,7 @@ static void UploadFileWithOptions()
135123 // ASCII for "HelloWorld"
136124 byte [ ] bytes = { 72 , 101 , 108 , 108 , 111 , 87 , 111 , 114 , 108 , 100 } ;
137125
138- for ( int i = 0 ; i < 5 ; i ++ )
139- {
140- uploader . Write ( bytes , 0 , bytes . Length ) ;
141- }
142-
126+ uploader . Write ( bytes , 0 , bytes . Length ) ;
143127 uploader . Close ( ) ;
144128 }
145129 // end-open-upload-stream-with-options
@@ -216,7 +200,7 @@ static async Task FindAsync()
216200 // start-find-async
217201 var filter = Builders < GridFSFileInfo > . Filter . Empty ;
218202 var files = await bucket . FindAsync ( filter ) ;
219- await files . ForEachAsync ( file => { Console . WriteLine ( file . ToJson ( ) ) ; } ) ;
203+ await files . ForEachAsync ( file => Console . Out . WriteLineAsync ( file . ToJson ( ) ) )
220204 // end-find-async
221205 }
222206
0 commit comments