注 I m 不仅试图查明某些手工艺类型是否可使用电子计算机:
一、导言
// is "toType" some sort of sequence that would be satisfied
// by an array of type T? If so, what is the type of T?
// e.g.
// getArrayType(typeof(string[]) == typeof(string)
// getArrayType(typeof(IEnumerable<int>)) == typeof(int)
// getArrayType(typeof(List<string>)) == null // NOTE - Array<string> does not convert to List<string>
// etc.
private static Type getArrayType(Type toType)
{
if (toType.IsArray)
{
if (toType.GetArrayRank() != 1)
return null;
return toType.GetElementType();
}
// Look for IEnumerable<T>, and if so, return the type of T
if (toType.IsGenericType && toType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
return toType.GetGenericArguments()[0];
return null;
}
它能够更好处理更多案件? 例如,目前的情况
getType(typeof(ICollection<string>)) == null
但扼杀可兑换成英磅
此外,我事先不知道“要素”类型是什么。
情况是:我撰写一份对描述性语言具有约束力的思考材料,如果你将物体[]传递给某种预期数字的方法(如果将输入阵列的每个要素转换到插图中的话),我想说的是“合理的工作”。
因此,我要澄清,我有某种方法签字:
void WriteCSV(ICollection<string> fields);
我的发言稿译员有一系列物体,它们都可能无意中显示:
object[] fields = new object[] { "one", 2, "three" };
然后,我的笔记译员需要指出,本案的真正需要是一系列的扼杀。
我要求我的译员放弃:
void WriteCSV(IRecord record);
<>7> 记录甚至可能实施一些可计量的电子数据:
interface IRecord : IEnumerable<string>
{
void OtherMethods();
}
我无法从一系列东西中构筑《国际记录》。
因此,仅仅发现我需要的是哪类迷信。 页: 1 这里没有我?