摘要:recursiveFunction(items, childrenNodeName, ids) { console.log('items', ids); // 获取数组长度 if (items) items = []; let len = items?.length // 循环遍历数组 for (l
阅读全文
摘要:// 函数和方法 // 函数好比对象的动作行为 在定义函数的时候,职责(作用/功能)越单一越好 满足高内聚 低耦合的开发思路 // 变量的命名规则 小驼峰 // 函数的命名规则 大驼峰 动词开头 // 函数的参数 参数可以认为是外部需要函数帮忙处理的数据 外部通过传参的形式把需要处理的参数传递给函数
阅读全文
摘要:// 显式转换 (类型) /// (int)表示使用强制的显示转换,是一种类型转换,C#默认的整形是 int32 , /// 因此使用此方法转成int32 不遵循四舍五入,直截取整数部分 /// (int)5.12 结果是 5 /// Int.Parse() 指把 string 类型转换 int 类
阅读全文
摘要:· // 数组 /// 数组是一组相同类型的数据(ps:js中的数组可以不同类型) 访问通过索引访问数组元素 /// 数组的声明 要使用 new 使用 {} 来初始化数组元素 还需要指定数组的大小 /// // 声明了一个没有元素的数组 int[] iarr = new int[6]; // 规定了
阅读全文
摘要:// C# 中的新语法 switch 的简写 string str = "123"; string res = str switch { "1" => "1", "2" => "2", "3" => "3", _ => "default", };
阅读全文
摘要:// C# 运算符 // 表达式 表达式有操作数(operand)和运算符(operator)构成; // 常见的运算符 + - * / 和 new // x ?? y 如果x为null, 则计算机过为y否则计算结果为x; // 匿名函数 (lamba表达式) // 前置的 ++ 直接执行 后置的
阅读全文
摘要:// 空类型 null int iii; // 默认 0 bool bbb; // 默认 false bool? b; // 空值 null int? i; // 空值 null string str; // 默认 null 空值 str = null; string str1 = ""; // n
阅读全文
摘要:// 布尔类型 boll bool b = false; b = 1 == 1; // true bool b1 = 1 > 23; // false // 值类型 : 在代码中初始化类型的时候没有赋值 但是系统会自动赋值的叫值类型 // byte short int(default 0) long
阅读全文
摘要:// 浮点型数据 float double(双精度) // float f = 1.1; // ps:写小数的时候只要后面没有加上 f/F 默认是double类型 // 正确的定义 double d = 1.1; float f = 1.1F; float f1 = 1f; // f = d; //
阅读全文
摘要:// C# 中有四种整数类型 byte short int long byte bMax = byte.MaxValue; /// 255 最大值 byte bMin = byte.MinValue; /// 0 最小值 short sMax = short.MaxValue; // 32767 s
阅读全文
摘要:#include <iostream> // 定义一个宏函数 #define ADD(x,y) x+y; // 宏函数具有速度快等特点 但是写代码有些业务比较繁琐,所以C++中使用了内联函数优化 // 在定义函数前面添加一个inline把这个函数变成内联函数 inline int max(int x
阅读全文
摘要:#include <iostream> using namespace std; void show(){ cout << "全局函数" << endl; } struct Stu { int a; void write_code(){ cout << "成员函数" << endl; } }; in
阅读全文
摘要:1 #include <iostream> 2 3 using namespace std; 4 5 6 // 结构体 7 struct Stu{ 8 string name; 9 int age; 10 11 // 结构体重的函数叫做成员函数 在 C 中是不能直接写函数的 只能使用函数指针,通过指
阅读全文
摘要:#include <iostream> // #include 头文件,C++标准库的头文件都不带 .h (.h 是C库头文件添加的) #include <cstdio> #include <cstring> using namespace std; // namespace 命名空间 为了防止变量
阅读全文
摘要:import { CreateBuriedPoints } from '@/api/Statistics'; export const DurationStay = { data(){ return { currentTime:"", DurationOfStay: 5*60*1000, //自定义
阅读全文