in src/AutoRest.CSharp/Common/Generation/Types/CSharpType.cs [230:282]
private bool TypeIsReadOnlyMemory()
=> IsFrameworkType && _type == typeof(ReadOnlyMemory<>);
private bool TypeIsReadOnlyList()
=> IsFrameworkType && (_type == typeof(IEnumerable<>) || _type == typeof(IReadOnlyList<>));
private bool TypeIsReadWriteList()
=> IsFrameworkType && (_type == typeof(IList<>) || _type == typeof(ICollection<>) || _type == typeof(List<>));
private bool TypeIsList()
=> IsReadOnlyList || IsReadWriteList || IsReadOnlyMemory;
private bool TypeIsArray()
=> IsFrameworkType && FrameworkType.IsArray;
private bool TypeIsReadOnlyDictionary()
=> IsFrameworkType && _type == typeof(IReadOnlyDictionary<,>);
private bool TypeIsReadWriteDictionary()
=> IsFrameworkType && (_type == typeof(IDictionary<,>));
private bool TypeIsDictionary()
=> IsReadOnlyDictionary || IsReadWriteDictionary;
private bool TypeIsCollection()
=> IsFrameworkType && (IsDictionary || IsList);
/// <summary>
/// Retrieves the <see cref="CSharpType"/> implementation type for the <see cref="_type"/>.
/// </summary>
/// <returns>The implementation type <see cref="CSharpType"/>.</returns>
private CSharpType GetImplementationType()
{
if (IsFrameworkType)
{
if (IsReadOnlyMemory)
{
return new CSharpType(Arguments[0].FrameworkType.MakeArrayType());
}
if (IsList)
{
return new CSharpType(typeof(List<>), Arguments);
}
if (IsDictionary)
{
return new CSharpType(typeof(Dictionary<,>), Arguments);
}
}
return this;
}