|
2 | 2 |
|
3 | 3 | public class Class1
|
4 | 4 | {
|
5 |
| - public static void Main() |
6 |
| - { |
7 |
| - // <Snippet1> |
8 |
| - byte[] bytes1 = new byte[100]; |
9 |
| - byte[] bytes2 = new byte[100]; |
10 |
| - Random rnd1 = new Random(); |
11 |
| - Random rnd2 = new Random(); |
| 5 | + public static void Main() |
| 6 | + { |
| 7 | + // <Snippet1> |
| 8 | + byte[] bytes1 = new byte[100]; |
| 9 | + byte[] bytes2 = new byte[100]; |
| 10 | + Random rnd1 = new(); |
| 11 | + Random rnd2 = new(); |
12 | 12 |
|
13 |
| - rnd1.NextBytes(bytes1); |
14 |
| - rnd2.NextBytes(bytes2); |
| 13 | + rnd1.NextBytes(bytes1); |
| 14 | + rnd2.NextBytes(bytes2); |
15 | 15 |
|
16 |
| - Console.WriteLine("First Series:"); |
17 |
| - for (int ctr = bytes1.GetLowerBound(0); |
18 |
| - ctr <= bytes1.GetUpperBound(0); |
19 |
| - ctr++) { |
20 |
| - Console.Write("{0, 5}", bytes1[ctr]); |
21 |
| - if ((ctr + 1) % 10 == 0) Console.WriteLine(); |
22 |
| - } |
| 16 | + Console.WriteLine("First Series:"); |
| 17 | + for (int ctr = bytes1.GetLowerBound(0); |
| 18 | + ctr <= bytes1.GetUpperBound(0); |
| 19 | + ctr++) |
| 20 | + { |
| 21 | + Console.Write($"{bytes1[ctr],5}"); |
| 22 | + if ((ctr + 1) % 10 == 0) |
| 23 | + Console.WriteLine(); |
| 24 | + } |
23 | 25 |
|
24 |
| - Console.WriteLine(); |
| 26 | + Console.WriteLine(); |
25 | 27 |
|
26 |
| - Console.WriteLine("Second Series:"); |
27 |
| - for (int ctr = bytes2.GetLowerBound(0); |
28 |
| - ctr <= bytes2.GetUpperBound(0); |
29 |
| - ctr++) { |
30 |
| - Console.Write("{0, 5}", bytes2[ctr]); |
31 |
| - if ((ctr + 1) % 10 == 0) Console.WriteLine(); |
32 |
| - } |
| 28 | + Console.WriteLine("Second Series:"); |
| 29 | + for (int ctr = bytes2.GetLowerBound(0); |
| 30 | + ctr <= bytes2.GetUpperBound(0); |
| 31 | + ctr++) |
| 32 | + { |
| 33 | + Console.Write("{bytes2[ctr], 5}"); |
| 34 | + if ((ctr + 1) % 10 == 0) |
| 35 | + Console.WriteLine(); |
| 36 | + } |
33 | 37 |
|
34 |
| - // The example displays output like the following: |
35 |
| - // First Series: |
36 |
| - // 97 129 149 54 22 208 120 105 68 177 |
37 |
| - // 113 214 30 172 74 218 116 230 89 18 |
38 |
| - // 12 112 130 105 116 180 190 200 187 120 |
39 |
| - // 7 198 233 158 58 51 50 170 98 23 |
40 |
| - // 21 1 113 74 146 245 34 255 96 24 |
41 |
| - // 232 255 23 9 167 240 255 44 194 98 |
42 |
| - // 18 175 173 204 169 171 236 127 114 23 |
43 |
| - // 167 202 132 65 253 11 254 56 214 127 |
44 |
| - // 145 191 104 163 143 7 174 224 247 73 |
45 |
| - // 52 6 231 255 5 101 83 165 160 231 |
46 |
| - // |
47 |
| - // Second Series: |
48 |
| - // 97 129 149 54 22 208 120 105 68 177 |
49 |
| - // 113 214 30 172 74 218 116 230 89 18 |
50 |
| - // 12 112 130 105 116 180 190 200 187 120 |
51 |
| - // 7 198 233 158 58 51 50 170 98 23 |
52 |
| - // 21 1 113 74 146 245 34 255 96 24 |
53 |
| - // 232 255 23 9 167 240 255 44 194 98 |
54 |
| - // 18 175 173 204 169 171 236 127 114 23 |
55 |
| - // 167 202 132 65 253 11 254 56 214 127 |
56 |
| - // 145 191 104 163 143 7 174 224 247 73 |
57 |
| - // 52 6 231 255 5 101 83 165 160 231 |
58 |
| - // </Snippet1> |
59 |
| - } |
| 38 | + // The example displays output like the following: |
| 39 | + // First Series: |
| 40 | + // 97 129 149 54 22 208 120 105 68 177 |
| 41 | + // 113 214 30 172 74 218 116 230 89 18 |
| 42 | + // 12 112 130 105 116 180 190 200 187 120 |
| 43 | + // 7 198 233 158 58 51 50 170 98 23 |
| 44 | + // 21 1 113 74 146 245 34 255 96 24 |
| 45 | + // 232 255 23 9 167 240 255 44 194 98 |
| 46 | + // 18 175 173 204 169 171 236 127 114 23 |
| 47 | + // 167 202 132 65 253 11 254 56 214 127 |
| 48 | + // 145 191 104 163 143 7 174 224 247 73 |
| 49 | + // 52 6 231 255 5 101 83 165 160 231 |
| 50 | + // |
| 51 | + // Second Series: |
| 52 | + // 97 129 149 54 22 208 120 105 68 177 |
| 53 | + // 113 214 30 172 74 218 116 230 89 18 |
| 54 | + // 12 112 130 105 116 180 190 200 187 120 |
| 55 | + // 7 198 233 158 58 51 50 170 98 23 |
| 56 | + // 21 1 113 74 146 245 34 255 96 24 |
| 57 | + // 232 255 23 9 167 240 255 44 194 98 |
| 58 | + // 18 175 173 204 169 171 236 127 114 23 |
| 59 | + // 167 202 132 65 253 11 254 56 214 127 |
| 60 | + // 145 191 104 163 143 7 174 224 247 73 |
| 61 | + // 52 6 231 255 5 101 83 165 160 231 |
| 62 | + // </Snippet1> |
| 63 | + } |
60 | 64 | }
|
0 commit comments