in src/NMS.AMQP/Util/Types/ConversionSupport.cs [123:168]
public static IList ListToAmqp(IList ilist)
{
if (ilist == null) return null;
//
// Special case for Byte[] which has the iList interface, we
// don't want to convert Byte[] to a List so just return a copy.
// Return a copy because it may be added to a List or Dictionary as
// a reference, which will arrive here, and we want to be sure we have
// our own copy after return.
if (ilist is Byte[])
{
byte[] copy = new byte[(ilist as Byte[]).Length];
Array.Copy(ilist as Byte[], 0, copy, 0, (ilist as Byte[]).Length);
return copy;
}
List list = new List();
foreach(object o in ilist)
{
object value = o;
if(o != null)
{
Type valtype = value.GetType();
if (value is IDictionary)
{
value = ConversionSupport.MapToAmqp(value as IDictionary);
}
else if (value is IList)
{
value = ConversionSupport.ListToAmqp(value as IList);
}
else if (ConversionSupport.IsNMSType(value))
//else if (valtype.IsPrimitive || value is byte[] || value is String)
{
// do nothing
// value = value;
}
else
{
Tracer.InfoFormat("Failed to convert IList to amqp List value({0}): Invalid Type: {1}",
value.ToString(), valtype.Name);
}
}
list.Add(value);
}
return list;
}