private static void ValidateAmqpPrimitive()

in sdk/core/Azure.Core.Amqp/src/AmqpMessageBody.cs [155:232]


        private static void ValidateAmqpPrimitive(object value, string paramName)
        {
            Argument.AssertNotNull(value, paramName);
            switch (value)
            {
                case string:
                case byte:
                case sbyte:
                case char:
                case short:
                case ushort:
                case int:
                case uint:
                case long:
                case ulong:
                case float:
                case double:
                case decimal:
                case bool:
                case Guid:
                case DateTime:
                case DateTimeOffset:
                case TimeSpan:
                case Uri:
                case IEnumerable<string>:
                case IEnumerable<byte>:
                case IEnumerable<sbyte>:
                case IEnumerable<char>:
                case IEnumerable<short>:
                case IEnumerable<ushort>:
                case IEnumerable<int>:
                case IEnumerable<uint>:
                case IEnumerable<long>:
                case IEnumerable<ulong>:
                case IEnumerable<float>:
                case IEnumerable<double>:
                case IEnumerable<decimal>:
                case IEnumerable<bool>:
                case IEnumerable<Guid>:
                case IEnumerable<DateTime>:
                case IEnumerable<DateTimeOffset>:
                case IEnumerable<TimeSpan>:
                case IEnumerable<Uri>:
                case IEnumerable<KeyValuePair<string, string>>:
                case IEnumerable<KeyValuePair<string, byte>>:
                case IEnumerable<KeyValuePair<string, sbyte>>:
                case IEnumerable<KeyValuePair<string, char>>:
                case IEnumerable<KeyValuePair<string, short>>:
                case IEnumerable<KeyValuePair<string, ushort>>:
                case IEnumerable<KeyValuePair<string, int>>:
                case IEnumerable<KeyValuePair<string, uint>>:
                case IEnumerable<KeyValuePair<string, long>>:
                case IEnumerable<KeyValuePair<string, ulong>>:
                case IEnumerable<KeyValuePair<string, float>>:
                case IEnumerable<KeyValuePair<string, double>>:
                case IEnumerable<KeyValuePair<string, decimal>>:
                case IEnumerable<KeyValuePair<string, bool>>:
                case IEnumerable<KeyValuePair<string, Guid>>:
                case IEnumerable<KeyValuePair<string, DateTime>>:
                case IEnumerable<KeyValuePair<string, DateTimeOffset>>:
                case IEnumerable<KeyValuePair<string, TimeSpan>>:
                case IEnumerable<KeyValuePair<string, Uri>>:
                    return;
                case KeyValuePair<string, object> kvp:
                    ValidateAmqpPrimitive(kvp.Value, paramName);
                    break;
                case IEnumerable enumerable:
                    foreach (object val in enumerable)
                    {
                        ValidateAmqpPrimitive(val, paramName);
                    }
                    break;
                default:
                    throw new NotSupportedException($"Values of type {value.GetType()} are not supported. " +
                        $"Only the following types are supported: string, byte, char, short, int, long, float, double, decimal, bool, " +
                        $"Guid, DateTime, DateTimeOffset, Timespan, Uri.");
            }
        }