@@ -137,26 +137,11 @@ private static async Task BasicStorageBlockBlobOperationsAsync()
137
137
Console . WriteLine ( "5. Create a read-only snapshot of the blob" ) ;
138
138
CloudBlockBlob blockBlobSnapshot = await blockBlob . CreateSnapshotAsync ( null , null , null , null ) ;
139
139
140
- // Create three new blocks and upload them to the existing blob
141
- Console . WriteLine ( "6. Create three new blocks and upload them to the existing blob" ) ;
142
- byte [ ] buffer = GetRandomBuffer ( 1024 ) ;
143
- List < string > blocks = GetBlockIdList ( 3 ) ;
144
-
145
- foreach ( string block in blocks )
146
- {
147
- using ( MemoryStream memoryStream = new MemoryStream ( buffer ) )
148
- {
149
- await blockBlob . PutBlockAsync ( block , memoryStream , null ) ;
150
- }
151
- }
152
- // Important: Please make sure that you call PutBlockList in order to commit the blocks to the blob
153
- await blockBlob . PutBlockListAsync ( blocks , null , null , null ) ;
154
-
155
140
// Clean up after the demo
156
- Console . WriteLine ( "7 . Delete block Blob and all of its snapshots" ) ;
141
+ Console . WriteLine ( "6 . Delete block Blob and all of its snapshots" ) ;
157
142
await blockBlob . DeleteIfExistsAsync ( DeleteSnapshotsOption . IncludeSnapshots , null , null , null ) ;
158
143
159
- Console . WriteLine ( "8 . Delete Container" ) ;
144
+ Console . WriteLine ( "7 . Delete Container" ) ;
160
145
await container . DeleteIfExistsAsync ( ) ;
161
146
}
162
147
@@ -249,33 +234,5 @@ private static CloudStorageAccount CreateStorageAccountFromConnectionString(stri
249
234
250
235
return storageAccount ;
251
236
}
252
-
253
- /// <summary>
254
- /// Creates a new random byte array
255
- /// </summary>
256
- /// <param name="size">Size of the Byte Array</param>
257
- /// <returns>byte[] object</returns>
258
- public static byte [ ] GetRandomBuffer ( int size )
259
- {
260
- byte [ ] buffer = new byte [ size ] ;
261
- Random random = new Random ( ) ;
262
- random . NextBytes ( buffer ) ;
263
- return buffer ;
264
- }
265
-
266
- /// <summary>
267
- /// Returns the list of BlockIds
268
- /// </summary>
269
- /// <param name="count">Number of blocks</param>
270
- /// <returns>List(string) object</returns>
271
- public static List < string > GetBlockIdList ( int count )
272
- {
273
- List < string > blocks = new List < string > ( ) ;
274
- for ( int i = 0 ; i < count ; i ++ )
275
- {
276
- blocks . Add ( Convert . ToBase64String ( Guid . NewGuid ( ) . ToByteArray ( ) ) ) ;
277
- }
278
- return blocks ;
279
- }
280
237
}
281
238
}
0 commit comments