上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: 方法一:可以用LINQ Select方法(推荐) 方法二:在C#中,可以使用 Array.ConvertAll 方法来将字符串数组转换为整数数组。 class Program { static void Main(string[] args) { //案例1: // 使用 Array.Convert 阅读全文
posted @ 2024-10-31 11:03 katesharing 阅读(468) 评论(0) 推荐(0)
摘要: 例子一:泛型类不含构造函数 using System; using System.Reflection; namespace 使用反射调用泛型类的方法 { class Program { static void Main(string[] args) { //定义要使用的类型参数(就是调用方法时要传 阅读全文
posted @ 2024-10-24 17:41 katesharing 阅读(58) 评论(0) 推荐(0)
摘要: 1. 总结 typeof:用于获取编译时已知类型的 Type 对象。适用于静态类型检查。 GetType:用于获取运行时对象的实际类型的 Type 对象。适用于动态类型检查。 选择使用哪一个取决于你的具体需求: 如果你知道类型并且在编译时确定,使用 typeof。 如果你需要在运行时根据对象的实际类 阅读全文
posted @ 2024-10-24 16:47 katesharing 阅读(95) 评论(0) 推荐(0)
摘要: 如何根据一列或多列来去重? 答案见下面: https://stackoverflow.com/questions/14321013/distinct-in-linq-based-on-only-one-field-of-the-table 阅读全文
posted @ 2024-09-30 11:23 katesharing 阅读(8) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2024-09-29 15:05 katesharing 阅读(38) 评论(0) 推荐(0)
摘要: 原文: https://stackoverflow.com/questions/37250446/how-to-pivot-data-in-linq-without-hard-coding-columns 例子如下: 文中给出的解决方案 public static class PivotClass 阅读全文
posted @ 2024-09-04 17:39 katesharing 阅读(16) 评论(0) 推荐(0)
摘要: 1. 除了加上 Environment.NewLine 2.还要加上如下语句,重要就是WrapText这个参数要设置为true 阅读全文
posted @ 2024-08-19 10:30 katesharing 阅读(172) 评论(0) 推荐(0)
摘要: stackoverflow上有一个类似的问题 https://stackoverflow.com/questions/29285897/difference-between-for-in-and-for-of-statements //for..of与for..in的区别 var arr = [3, 阅读全文
posted @ 2024-08-15 18:26 katesharing 阅读(8) 评论(0) 推荐(0)
摘要: 读取属性的方法记一下 //js object的写法 const person = { firstName: "John", lastName: "Doe", age: 50, eyeColor: "blue", fullName: function () { return this.firstNam 阅读全文
posted @ 2024-08-15 18:17 katesharing 阅读(15) 评论(0) 推荐(0)
摘要: 一、常用的测试写法 //array的写法 var myArray = ["Apple", "Orange", "Banana"]; //一、正常循环写法如下: var fruitFinal3 = "" for (var i = 0; i < myArray.length; i++) { fruitF 阅读全文
posted @ 2024-08-15 17:58 katesharing 阅读(10) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 13 下一页