object[] objs = new object[] { "12345", 12 }; objs.Cast<object>().ToArray(); //throws InvalidCastException,int 无法 (string)12 这样直接转成string objs.OfType<string>().ToArray(); //return { "12345" } Console.ReadLine();
作者:spike
分类: Net
创作时间:2023-06-25
更新时间:2024-12-09