Пример #1
0
 public static INamedTypeSymbol CreateTupleTypeSymbol(
     this CSharpCompilation comp,
     NamedTypeSymbol underlyingType,
     ImmutableArray <string> elementNames       = default,
     ImmutableArray <Location> elementLocations = default)
 {
     return(comp.CreateTupleTypeSymbol(underlyingType.GetPublicSymbol(), elementNames, elementLocations));
 }
Пример #2
0
        public void GetFriendlyName_ShouldWorkWithTuples()
        {
            CSharpCompilation compilation = CreateCompilation(string.Empty);

            INamedTypeSymbol tuple = compilation.CreateTupleTypeSymbol(new ITypeSymbol[] { compilation.GetSpecialType(SpecialType.System_String), compilation.GetSpecialType(SpecialType.System_Int32) }.ToImmutableArray(), new[] { "Cica", "Mica" }.ToImmutableArray());

            Assert.That(tuple.GetFriendlyName(), Is.EqualTo("System.ValueTuple"));
        }
Пример #3
0
 public static INamedTypeSymbol CreateTupleTypeSymbol(
     this CSharpCompilation comp,
     ImmutableArray <TypeSymbol> elementTypes,
     ImmutableArray <string> elementNames       = default,
     ImmutableArray <Location> elementLocations = default,
     ImmutableArray <Microsoft.CodeAnalysis.NullableAnnotation> elementNullableAnnotations = default)
 {
     return(comp.CreateTupleTypeSymbol(elementTypes.GetPublicSymbols(), elementNames, elementLocations, elementNullableAnnotations));
 }