# 基础知识
- 数据类型
bool 布尔值 True 或 False False
byte 8 位无符号整数 0 到 255 0
char 16 位 Unicode 字符 U +0000 到 U +ffff '\\0'
decimal 128 位精确的十进制值,28-29 有效位数 (-7.9 x 1028 到 7.9 x 1028) / 100 到 28 0.0M
double 64 位双精度浮点型 (+/-)5.0 x 10-324 到 (+/-)1.7 x 10308 0.0D
float 32 位单精度浮点型 -3.4 x 1038 到 + 3.4 x 1038 0.0F
int 32 位有符号整数类型 -2,147,483,648 到 2,147,483,647 0
long 64 位有符号整数类型 -9,223,372,036,854,775,808 到 9,223,372,036,854,775,807 0L
sbyte 8 位有符号整数类型 -128 到 127 0
short 16 位有符号整数类型 -32,768 到 32,767 0
uint 32 位无符号整数类型 0 到 4,294,967,295 0
ulong 64 位无符号整数类型 0 到 18,446,744,073,709,551,615 0
ushort 16 位无符号整数类型 0 到 65,535 0
```
<pre class="calibre14">```
double<span class="token2">[</span><span class="token2">]</span> balance <span class="token">=</span> <span class="token5">new</span> <span class="token1">double</span><span class="token2">[</span><span class="token3">10</span><span class="token2">]</span><span class="token2">;</span>声明数组十个元素
double<span class="token2">[</span><span class="token2">]</span> balance <span class="token">=</span> <span class="token2">{</span> <span class="token3">2340.0</span><span class="token2">,</span> <span class="token3">4523.69</span><span class="token2">,</span> <span class="token3">3421.0</span><span class="token2">}</span><span class="token2">;</span>
int <span class="token2">[</span><span class="token2">]</span> marks <span class="token">=</span> <span class="token5">new</span> <span class="token1">int</span><span class="token2">[</span><span class="token2">]</span> <span class="token2">{</span> <span class="token3">99</span><span class="token2">,</span> <span class="token3">98</span><span class="token2">,</span> <span class="token3">92</span><span class="token2">,</span> <span class="token3">97</span><span class="token2">,</span> <span class="token3">95</span><span class="token2">}</span><span class="token2">;</span>
int <span class="token2">[</span><span class="token2">]</span><span class="token2">[</span><span class="token2">]</span> scores<span class="token2">;</span> 交错数组<span class="token2">,</span>属于一维数组
string <span class="token2">[</span><span class="token2">,</span><span class="token2">]</span> names<span class="token2">;</span> 二维数组
int <span class="token2">[</span> <span class="token2">,</span> <span class="token2">,</span> <span class="token2">]</span> m<span class="token2">;</span> 三维数组
int <span class="token2">[</span><span class="token2">,</span><span class="token2">]</span> a <span class="token">=</span> <span class="token5">new</span> <span class="token1">int</span> <span class="token2">[</span><span class="token3">3</span><span class="token2">,</span><span class="token3">4</span><span class="token2">]</span> <span class="token2">{</span>
<span class="token2">{</span><span class="token3">0</span><span class="token2">,</span> <span class="token3">1</span><span class="token2">,</span> <span class="token3">2</span><span class="token2">,</span> <span class="token3">3</span><span class="token2">}</span> <span class="token2">,</span> <span class="token6">/* 初始化索引号为 0 的行 */</span>
<span class="token2">{</span><span class="token3">4</span><span class="token2">,</span> <span class="token3">5</span><span class="token2">,</span> <span class="token3">6</span><span class="token2">,</span> <span class="token3">7</span><span class="token2">}</span> <span class="token2">,</span> <span class="token6">/* 初始化索引号为 1 的行 */</span>
<span class="token2">{</span><span class="token3">8</span><span class="token2">,</span> <span class="token3">9</span><span class="token2">,</span> <span class="token3">10</span><span class="token2">,</span> <span class="token3">11</span><span class="token2">}</span> <span class="token6">/* 初始化索引号为 2 的行 */</span>
<span class="token2">}</span><span class="token2">;</span>
struct Books 结构体类型
<span class="token2">{</span>
public string title<span class="token2">;</span>
public string author<span class="token2">;</span>
public string subject<span class="token2">;</span>
public int book_id<span class="token2">;</span>
<span class="token2">}</span><span class="token2">;</span>
enum Day <span class="token2">{</span> Sun<span class="token2">,</span> Mon<span class="token2">,</span> Tue<span class="token2">,</span> Wed<span class="token2">,</span> Thu<span class="token2">,</span> Fri<span class="token2">,</span> Sat <span class="token2">}</span><span class="token2">;</span> 枚举类型
class <span class="token1">Line</span><span class="token2">{</span>
private double length<span class="token2">;</span>私有方法
public void <span class="token1">setLength</span><span class="token2">(</span> double len <span class="token2">)</span> 可访问方法
<span class="token2">{</span>
length <span class="token">=</span> len<span class="token2">;</span>
<span class="token2">}</span>
static void <span class="token1">Main</span><span class="token2">(</span>string<span class="token2">[</span><span class="token2">]</span> args<span class="token2">)</span><span class="token2">{</span><span class="token2">}</span> 静态方法
<span class="token2">}</span>
class <span class="token1">A</span><span class="token2">:</span>Line<span class="token2">{</span><span class="token2">}</span> 继承类
interface <span class="token1">IMyInterface</span> 接口
<span class="token2">{</span>
<span class="token6">// 接口成员</span>
void <span class="token1">MethodToImplement</span><span class="token2">(</span><span class="token2">)</span><span class="token2">;</span>
<span class="token2">}</span>
namespace namespace_name 命名空间
<span class="token2">{</span>
<span class="token6">// 代码声明</span>
<span class="token2">}</span>
object obj<span class="token2">;</span> 对象类型
dynamic d <span class="token">=</span> <span class="token3">20</span><span class="token2">;</span> 动态类型<span class="token2">,</span>自动推断<span class="token2">,</span>可以是任何类型
String str <span class="token">=</span> <span class="token4">"runoob.com"</span><span class="token2">;</span> 字符串类型
string str <span class="token">=</span> @<span class="token4">"C:\Windows"</span><span class="token2">;</span> 不会转义
type<span class="token">*</span> identifier<span class="token2">;</span> 指针类型
double d <span class="token">=</span> <span class="token3">5673.74</span><span class="token2">;</span>d<span class="token">=</span> <span class="token2">(</span>int<span class="token2">)</span>d<span class="token2">;</span> 类型转换
方法转换如下
<span class="token3">1</span> ToBoolean
如果可能的话,把类型转换为布尔型。
<span class="token3">2</span> ToByte
把类型转换为字节类型。
<span class="token3">3</span> ToChar
如果可能的话,把类型转换为单个 Unicode 字符类型。
<span class="token3">4</span> ToDateTime
把类型(整数或字符串类型)转换为 日期<span class="token">-</span>时间 结构。
<span class="token3">5</span> ToDecimal
把浮点型或整数类型转换为十进制类型。
<span class="token3">6</span> ToDouble
把类型转换为双精度浮点型。
<span class="token3">7</span> ToInt16
把类型转换为 <span class="token3">16</span> 位整数类型。
<span class="token3">8</span> ToInt32
把类型转换为 <span class="token3">32</span> 位整数类型。
<span class="token3">9</span> ToInt64
把类型转换为 <span class="token3">64</span> 位整数类型。
<span class="token3">10</span> ToSbyte
把类型转换为有符号字节类型。
<span class="token3">11</span> ToSingle
把类型转换为小浮点数类型。
<span class="token3">12</span> ToString
把类型转换为字符串类型。
<span class="token3">13</span> ToType
把类型转换为指定类型。
<span class="token3">14</span> ToUInt16
把类型转换为 <span class="token3">16</span> 位无符号整数类型。
<span class="token3">15</span> ToUInt32
把类型转换为 <span class="token3">32</span> 位无符号整数类型。
<span class="token3">16</span> ToUInt64
把类型转换为 <span class="token3">64</span> 位无符号整数类型。
```
```
- 变量和常量
```
<pre class="calibre14">```
int d <span class="token">=</span> <span class="token3">3</span><span class="token2">,</span> f <span class="token">=</span> <span class="token3">5</span><span class="token2">;</span>
const int c1 <span class="token">=</span> <span class="token3">5</span><span class="token2">;</span> 常量
const string a <span class="token">=</span> @<span class="token4">"中国人"</span><span class="token2">;</span>
```
```
- 运算符
```
<pre class="calibre14">```
<span class="token">+</span> <span class="token">-</span> <span class="token">*</span> <span class="token">/</span> <span class="token">++</span> <span class="token">--</span> <span class="token">%</span>
<span class="token">==</span> <span class="token">!=</span> <span class="token">></span> <span class="token">>=</span> <span class="token"><</span> <span class="token"><=</span> <span class="token">+</span><span class="token">=</span> <span class="token">-</span><span class="token">=</span> <span class="token">*</span><span class="token">=</span> <span class="token">/</span><span class="token">=</span> <span class="token">?</span><span class="token2">:</span>
<span class="token">&&</span> 与 <span class="token">||</span> 或 <span class="token">!</span>非
<span class="token1">sizeof</span><span class="token2">(</span><span class="token2">)</span> 数据类型
<span class="token1">typeof</span><span class="token2">(</span><span class="token2">)</span> class类型
<span class="token">&</span>a 变量地址
<span class="token">*</span>a 变量的指针
num3 <span class="token">=</span> num1 <span class="token">?</span><span class="token">?</span> <span class="token3">5.34</span><span class="token2">;</span> 值为<span class="token5">null</span>时候取值<span class="token2">,</span>类似php
```
```
- 条件语句
```
<pre class="calibre14">```
<span class="token5">if</span><span class="token2">(</span><span class="token2">)</span><span class="token2">{</span>
<span class="token2">}</span><span class="token5">else</span> <span class="token5">if</span><span class="token2">(</span><span class="token2">)</span><span class="token2">{</span>
<span class="token2">}</span><span class="token5">else</span><span class="token2">{</span>
<span class="token2">}</span>
switch <span class="token2">(</span>grade<span class="token2">)</span>
<span class="token2">{</span>
case <span class="token4">'A'</span><span class="token2">:</span>
Console<span class="token2">.</span><span class="token1">WriteLine</span><span class="token2">(</span><span class="token4">"很棒!"</span><span class="token2">)</span><span class="token2">;</span>
<span class="token5">break</span><span class="token2">;</span>
case <span class="token4">'B'</span><span class="token2">:</span>
case <span class="token4">'C'</span><span class="token2">:</span>
Console<span class="token2">.</span><span class="token1">WriteLine</span><span class="token2">(</span><span class="token4">"做得好"</span><span class="token2">)</span><span class="token2">;</span>
<span class="token5">break</span><span class="token2">;</span>
case <span class="token4">'D'</span><span class="token2">:</span>
Console<span class="token2">.</span><span class="token1">WriteLine</span><span class="token2">(</span><span class="token4">"您通过了"</span><span class="token2">)</span><span class="token2">;</span>
<span class="token5">break</span><span class="token2">;</span>
case <span class="token4">'F'</span><span class="token2">:</span>
Console<span class="token2">.</span><span class="token1">WriteLine</span><span class="token2">(</span><span class="token4">"最好再试一下"</span><span class="token2">)</span><span class="token2">;</span>
<span class="token5">break</span><span class="token2">;</span>
default<span class="token2">:</span>
Console<span class="token2">.</span><span class="token1">WriteLine</span><span class="token2">(</span><span class="token4">"无效的成绩"</span><span class="token2">)</span><span class="token2">;</span>
<span class="token5">break</span><span class="token2">;</span>
<span class="token2">}</span>
```
```
- 循环 continue跳出当前执行下一条,break;退出
```
<pre class="calibre16">```
<span class="token5">while</span><span class="token2">(</span>condition<span class="token2">)</span>
<span class="token2">{</span>
<span class="token2">}</span>
<span class="token5">for</span> <span class="token2">(</span>int a <span class="token">=</span> <span class="token3">10</span><span class="token2">;</span> a <span class="token"><</span> <span class="token3">20</span><span class="token2">;</span> a <span class="token">=</span> a <span class="token">+</span> <span class="token3">1</span><span class="token2">)</span>
<span class="token2">{</span>
Console<span class="token2">.</span><span class="token1">WriteLine</span><span class="token2">(</span><span class="token4">"a 的值: {0}"</span><span class="token2">,</span> a<span class="token2">)</span><span class="token2">;</span>
<span class="token2">}</span>
foreach <span class="token2">(</span>int element <span class="token5">in</span> fibarray<span class="token2">)</span> <span class="token6">//数组或对象</span>
<span class="token2">{</span>
<span class="token2">}</span>
```
```
- 简介
- 第一章 数据库
- Mysql/mariadb
- 函数
- 基础
- 增删改索引
- 标准查询
- 高级查询
- TIDB集群mysql解决方案
- Redis
- 语言基础
- 5种数据类型
- 其他类型
- Sqlite
- 语言基础
- 常用查询
- 第二章 PHP
- 语言基础
- 第一课 流程控制和运算
- 第二课 数组
- 第三课 日期时间
- 第四课 常用函数
- 第五课 字符串
- 第六课 文件操作
- 第七课 面向对象
- 第八课 正则表达式
- 第九课 图片处理生成
- 第十课 curl/memche
- 第十一课 mysql和pdo
- 第十三课 cookie和session
- 第十四课 xml操作
- 第十五课 php5.3+新特性
- 第十六课 php7+
- 第十七课 密码安全
- 废弃函数
- php命令行
- redis应用
- 算法
- 排序算法
- 基础算法
- 无限级分类
- 自定义函数Fn
- 查找算法
- 自定义函数数据函数fn
- laravel
- 路由
- 常用语句
- 数据库
- dingo/api
- Yii2
- 控制器
- 常用类
- 数据库
- redis
- thinkphp6
- TP6文档
- TP6插件
- dedecms
- 织梦标签大全
- 数据库操作
- 内置函数和定义函数
- 织梦核心改动
- 织梦插件/底层标签开发
- PHP相关工具
- composer
- php开发环境phpenv
- Phpstorm使用
- windows编译php扩展
- PHP开源库
- 开源项目管理禅道
- sns_auth
- php-casbin权限控制
- php-jwt
- 微信SDKeasywechat
- querylist采集库
- workerman
- Box/Spout处理excel和csv
- dll扩展
- redis/memche/xdebug
- redis
- Lua
- php_xlswriter
- event
- swoole
- 常用代码库
- 微擎框架
- 第一课全局变量
- 第二课常用函数
- 第三课自定义微擎独有函数
- 第四课数据库操作
- 第五课微信端回复
- 第六课微擎高级操作
- 第八课global函数列表
- mainfest.xml详解
- js方法
- 人人商城
- 第一课model解读
- 第二课常用语句解读
- 第三课常用js解读
- 第四课附录常见问题
- 第五课附录处理报表|支付
- 常用JSON状态码
- 第三章 JavaScript
- js基础
- 浏览器对象
- 语言基础
- html5接口
- ES6新语法
- vue
- 基础语法
- 京东vueUI组件
- uniapp
- 组件开发规范
- nodejs
- 基础知识
- 安装node
- nvm不同版本node切换
- js常用标准库
- zepto/jquery
- weui
- js图标库
- elementUI
- validator表单验证
- layer弹出层
- requirejs
- wow动画
- 动画animate
- swiper4
- 百度编辑器
- flyio/axios/qs
- jquery.form
- bootstrap3
- clipboard复制
- slideout侧滑
- imagehover.css图片悬停动画
- webpack打包
- Bulma UI框架
- store 客户端存储
- lottie动画创建库
- sweetalert
- js自定义函数
- 常见JSSDK
- 微信公众号JSSDK
- 腾讯地图jssdk
- 微信小程序
- 第四章 编程语言
- markdown语言
- Dart语言
- Dart语言基础
- Flutter框架
- Lua语言
- 字符串,数组,表
- 自定义方法
- go语言
- 第1.1语言基本语法
- 第1.2流程控制
- 第1.3函数
- 第1.4结构体
- 第1.5接口
- 第1.6包
- go语言框架Gin
- CSS3语言
- CSS与CSS3
- 选择符
- 属性
- css3
- loading动画
- HTML5语言
- less
- sass
- C#
- 基础知识
- 函数
- 第五章 开发工具
- git
- nginx/apache服务器
- Linux常用操作
- crontab定时任务
- 注册表与cmd
- 阿里云ECS
- frp穿透和ssl续期
- 宝塔安装
- 树莓派
- 浏览器模拟
- 火狐/chrome常用插件
- WSL安装使用
- mac brew和终端命令
- win10相关