|
3 | 3 | // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. |
4 | 4 | // </copyright> |
5 | 5 |
|
| 6 | +using System.Collections.Immutable; |
| 7 | +using System.Text; |
6 | 8 | using Datadog.Trace.SourceGenerators.TagsListGenerator; |
7 | 9 | using Datadog.Trace.SourceGenerators.TagsListGenerator.Diagnostics; |
8 | 10 | using Xunit; |
@@ -32,11 +34,7 @@ namespace MyTests.TestListNameSpace |
32 | 34 | partial class TestList |
33 | 35 | { |
34 | 36 | // IdBytes = MessagePack.Serialize(""TestId""); |
35 | | -#if NETCOREAPP |
36 | | - private static ReadOnlySpan<byte> IdBytes => new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
37 | | -#else |
38 | | - private static readonly byte[] IdBytes = new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
39 | | -#endif |
| 37 | + private static ReadOnlySpan<byte> IdBytes => [166, 84, 101, 115, 116, 73, 100]; |
40 | 38 |
|
41 | 39 | public override string? GetTag(string key) |
42 | 40 | { |
@@ -111,11 +109,7 @@ namespace MyTests.TestListNameSpace |
111 | 109 | partial class TestList |
112 | 110 | { |
113 | 111 | // IdBytes = MessagePack.Serialize(""TestId""); |
114 | | -#if NETCOREAPP |
115 | | - private static ReadOnlySpan<byte> IdBytes => new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
116 | | -#else |
117 | | - private static readonly byte[] IdBytes = new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
118 | | -#endif |
| 112 | + private static ReadOnlySpan<byte> IdBytes => [166, 84, 101, 115, 116, 73, 100]; |
119 | 113 |
|
120 | 114 | public override double? GetMetric(string key) |
121 | 115 | { |
@@ -193,17 +187,10 @@ namespace MyTests.TestListNameSpace |
193 | 187 | partial class TestList |
194 | 188 | { |
195 | 189 | // IdBytes = MessagePack.Serialize(""IdTag""); |
196 | | -#if NETCOREAPP |
197 | | - private static ReadOnlySpan<byte> IdBytes => new byte[] { 165, 73, 100, 84, 97, 103 }; |
198 | | -#else |
199 | | - private static readonly byte[] IdBytes = new byte[] { 165, 73, 100, 84, 97, 103 }; |
200 | | -#endif |
| 190 | + private static ReadOnlySpan<byte> IdBytes => [165, 73, 100, 84, 97, 103]; |
| 191 | +
|
201 | 192 | // NameBytes = MessagePack.Serialize(""NameTag""); |
202 | | -#if NETCOREAPP |
203 | | - private static ReadOnlySpan<byte> NameBytes => new byte[] { 167, 78, 97, 109, 101, 84, 97, 103 }; |
204 | | -#else |
205 | | - private static readonly byte[] NameBytes = new byte[] { 167, 78, 97, 109, 101, 84, 97, 103 }; |
206 | | -#endif |
| 193 | + private static ReadOnlySpan<byte> NameBytes => [167, 78, 97, 109, 101, 84, 97, 103]; |
207 | 194 |
|
208 | 195 | public override string? GetTag(string key) |
209 | 196 | { |
@@ -296,17 +283,10 @@ namespace MyTests.TestListNameSpace |
296 | 283 | partial class TestList |
297 | 284 | { |
298 | 285 | // IdBytes = MessagePack.Serialize(""IdMetric""); |
299 | | -#if NETCOREAPP |
300 | | - private static ReadOnlySpan<byte> IdBytes => new byte[] { 168, 73, 100, 77, 101, 116, 114, 105, 99 }; |
301 | | -#else |
302 | | - private static readonly byte[] IdBytes = new byte[] { 168, 73, 100, 77, 101, 116, 114, 105, 99 }; |
303 | | -#endif |
| 286 | + private static ReadOnlySpan<byte> IdBytes => [168, 73, 100, 77, 101, 116, 114, 105, 99]; |
| 287 | +
|
304 | 288 | // NameBytes = MessagePack.Serialize(""NameMetric""); |
305 | | -#if NETCOREAPP |
306 | | - private static ReadOnlySpan<byte> NameBytes => new byte[] { 170, 78, 97, 109, 101, 77, 101, 116, 114, 105, 99 }; |
307 | | -#else |
308 | | - private static readonly byte[] NameBytes = new byte[] { 170, 78, 97, 109, 101, 77, 101, 116, 114, 105, 99 }; |
309 | | -#endif |
| 289 | + private static ReadOnlySpan<byte> NameBytes => [170, 78, 97, 109, 101, 77, 101, 116, 114, 105, 99]; |
310 | 290 |
|
311 | 291 | public override double? GetMetric(string key) |
312 | 292 | { |
@@ -402,23 +382,13 @@ namespace MyTests.TestListNameSpace |
402 | 382 | partial class TestList |
403 | 383 | { |
404 | 384 | // IdBytes = MessagePack.Serialize(""IdTag""); |
405 | | -#if NETCOREAPP |
406 | | - private static ReadOnlySpan<byte> IdBytes => new byte[] { 165, 73, 100, 84, 97, 103 }; |
407 | | -#else |
408 | | - private static readonly byte[] IdBytes = new byte[] { 165, 73, 100, 84, 97, 103 }; |
409 | | -#endif |
| 385 | + private static ReadOnlySpan<byte> IdBytes => [165, 73, 100, 84, 97, 103]; |
| 386 | +
|
410 | 387 | // TestBytes = MessagePack.Serialize(""TestId""); |
411 | | -#if NETCOREAPP |
412 | | - private static ReadOnlySpan<byte> TestBytes => new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
413 | | -#else |
414 | | - private static readonly byte[] TestBytes = new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
415 | | -#endif |
| 388 | + private static ReadOnlySpan<byte> TestBytes => [166, 84, 101, 115, 116, 73, 100]; |
| 389 | +
|
416 | 390 | // NameBytes = MessagePack.Serialize(""NameTag""); |
417 | | -#if NETCOREAPP |
418 | | - private static ReadOnlySpan<byte> NameBytes => new byte[] { 167, 78, 97, 109, 101, 84, 97, 103 }; |
419 | | -#else |
420 | | - private static readonly byte[] NameBytes = new byte[] { 167, 78, 97, 109, 101, 84, 97, 103 }; |
421 | | -#endif |
| 391 | + private static ReadOnlySpan<byte> NameBytes => [167, 78, 97, 109, 101, 84, 97, 103]; |
422 | 392 |
|
423 | 393 | public override string? GetTag(string key) |
424 | 394 | { |
@@ -528,23 +498,13 @@ namespace MyTests.TestListNameSpace |
528 | 498 | partial class TestList |
529 | 499 | { |
530 | 500 | // IdBytes = MessagePack.Serialize(""IdMetric""); |
531 | | -#if NETCOREAPP |
532 | | - private static ReadOnlySpan<byte> IdBytes => new byte[] { 168, 73, 100, 77, 101, 116, 114, 105, 99 }; |
533 | | -#else |
534 | | - private static readonly byte[] IdBytes = new byte[] { 168, 73, 100, 77, 101, 116, 114, 105, 99 }; |
535 | | -#endif |
| 501 | + private static ReadOnlySpan<byte> IdBytes => [168, 73, 100, 77, 101, 116, 114, 105, 99]; |
| 502 | +
|
536 | 503 | // TestBytes = MessagePack.Serialize(""TestId""); |
537 | | -#if NETCOREAPP |
538 | | - private static ReadOnlySpan<byte> TestBytes => new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
539 | | -#else |
540 | | - private static readonly byte[] TestBytes = new byte[] { 166, 84, 101, 115, 116, 73, 100 }; |
541 | | -#endif |
| 504 | + private static ReadOnlySpan<byte> TestBytes => [166, 84, 101, 115, 116, 73, 100]; |
| 505 | +
|
542 | 506 | // NameBytes = MessagePack.Serialize(""NameMetric""); |
543 | | -#if NETCOREAPP |
544 | | - private static ReadOnlySpan<byte> NameBytes => new byte[] { 170, 78, 97, 109, 101, 77, 101, 116, 114, 105, 99 }; |
545 | | -#else |
546 | | - private static readonly byte[] NameBytes = new byte[] { 170, 78, 97, 109, 101, 77, 101, 116, 114, 105, 99 }; |
547 | | -#endif |
| 507 | + private static ReadOnlySpan<byte> NameBytes => [170, 78, 97, 109, 101, 77, 101, 116, 114, 105, 99]; |
548 | 508 |
|
549 | 509 | public override double? GetMetric(string key) |
550 | 510 | { |
|
0 commit comments