- 博客(39)
- 收藏
- 关注
原创 python 安装成功后终端显示的还是低版本
如果你下载了新版的 Python,但在使用时发现仍然是之前的版本,可能是因为新版的 Python 没有替代系统环境中的旧版 Python。
2023-10-28 19:17:50
5403
原创 C#执行sql语句
//SQL查询语句 public DataTable query(string sql) { DataTable dt=new DataTable(); string connString = "server=IP;uid=sa;pwd=;database=数据库名"; SqlConnection conn = new SqlConnection(connString); SqlDataAdapter adapter = new SqlDataAdapter(sql,con.
2020-06-12 17:30:16
627
转载 Unity中的贝塞尔曲线思路及实现(转)
转https://blog.youkuaiyun.com/GhostOrange/article/details/53613372那天突然在宣雨松的博客里看到了关于贝塞尔曲线的内容,然后发现根本无法理解他的代码,然后上网搜索了下,发现了以下漂亮的动图,于是乎我决定搞点事情。说到贝塞尔曲线,大家肯定不会陌生,很多插件都有它的身影,但是想要一窥它的细节总觉得有点困难,因为一到网上查询都是什么看不懂的公式啊(大神就不一样了),多项式啊吧啦吧啦的,说起多项式,估计大多数人都是感觉好像似曾相识,但是如果想要根据这些公式什
2020-06-01 16:11:02
879
原创 C#拆装箱
知道一点记一点装箱:值类型转化为objectint num=3;string str=" "+num;//产生了装箱操作string str=" "+num.ToString();//未产生装箱操作拆箱:object转化为值类型...
2019-12-07 13:40:33
240
原创 c#中decimal ,double,float的一些区别
单精度就是指4个字节的浮点数,即float双精度就是指8个字节的浮点数,即doubledecimal是高精度float num1=3.0f;float num2=2.9f;float result=num1-num2;bool b1=result==0.1f;Console.WriteLine(b1); false//因为精确度不够decimal num1=3.0m;d...
2019-11-26 11:38:00
735
转载 unity 自动寻路显示剩余路径
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.AI;[RequireComponent(typeof(NavMeshAgent))]public class test : MonoBehaviour{ NavMeshAgent m_Ag...
2019-06-05 13:22:47
583
转载 MySQL 电脑重启后连接不上 输入密码后直接关闭对话框
以下的方法,是网上搜索到的方法方法一:若出现输入密码闪屏情况,首先要检查mysql的服务是否启动,,查看的方法是:右键“我的电脑”->“管理”->“服务和应用程序”->“服务” 查看mysql 的服务的状态,若没有启动,则右键启动服务。再次启动界面,输入密码查看是否可以,一般mysql服务没有开启是主要原因。这种原因的诱因很多,本人上次在使用某免费杀毒软件优化以后,mysq...
2019-05-14 10:32:25
2856
1
原创 Unity 场景切换变暗
Window>>lighting>>Settings>>Scene面板>>右下角Generate Lighting按钮前,取消勾选auto,这时候是没有烘焙灯光的情形,重新加载场景后不再会变暗。如果需要烘培灯光,则点击Generate Lighting按钮即可,这时候将保存光照贴图信息,重新加载后也不会再变暗。...
2019-04-16 18:08:40
2409
2
转载 WinForm窗体及其控件的自适应
1.在需要自适应的Form中实例化全局变量 AutoSizeFormClass.cs源码在下方 AutoSizeFormClass asc = new AutoSizeFormClass();2.Form_Load事件中 asc.controllInitializeSize(this);3.Page_SizeChanged事件中 asc.cont...
2019-02-27 17:08:26
356
原创 C# 委托简单介绍
using System;using System.Collections.Generic;using System.Linq;using System.IO;using System.Text;using System.Threading.Tasks;namespace TestDelegate{ class Program { ...
2019-01-24 14:32:22
185
转载 C# string字符串插值(使用前缀$)
C# 引入了字符串前缀$的字符串插值。string s = "hello";string y = $"{s} world";等同于使用Format方法:string y = string.Format("{0} world",s);并且我们可以调用值的方法,如:string y = $"{s.ToLower()} world";使用新的字符串格式代码可读性要好一些如:...
2019-01-22 09:22:04
619
原创 System.InvalidOperationException:“线程间操作无效: 从不是创建控件“label1”的线程访问它。”
private void Form1_Load(object sender, EventArgs e) { //加载时 取消跨线程检查 Control.CheckForIllegalCrossThreadCalls = false; }...
2019-01-10 14:50:43
3015
原创 C# 连接Redis
使用 工具-->>nuget 添加 StackExchange.Redis单个Redis客户端:// 以StackOverflow.Redis的开源项目为例ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("Redis1_IP地址:端口,password=密码");// 创建NoSQL数据库IData...
2019-01-09 12:09:51
2472
转载 C# 创建INI文件,写入并可读取
using System.Text;using System.IO;using System.Runtime.InteropServices;namespace HotelSystemORM.Unitl{public class IniFiles {public string inipath;//声明API函数[DllImport("kernel32")] p...
2019-01-07 09:18:00
1545
转载 C# 获取系统时间及时间格式
--DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 取当前年月日时分秒 currentTime=System.DateTime.Now; 取当前年 int 年=currentTime.Year; 取当前月 int 月=currentTime.Month; 取当前日 int 日...
2019-01-04 19:38:56
348
原创 Unity 下拉框
首先在UI里添加组件Dropdownpublic class Test : MonoBehaviour { private Dropdown dropdown; private void Start() { dropdown = GetComponent<Dropdown>(); } public void Show() {...
2018-12-28 15:15:59
1124
原创 C#单例模式的几种实现方式
一、多线程不安全方式实现 public sealed class SingleInstance { private static SingleInstance instance; private SingleInstance() { } public static SingleInstance Instance { ...
2018-12-21 10:38:13
679
原创 C#跳出循环break,continue,go to,return的关键字
break是循环结束执行,执行循环体后面的代码。continue是跳过本次循环未执行的代码,继续执行下一次循环。goto是跳到指定的指令去,你指哪,他跳到哪。 test1://标签1 for (int i = 0; i < 10; i++) {test2://标签2 for (int j = 0; j...
2018-12-21 10:31:12
3993
原创 C#测程序运行时间
System.Diagnostics.Stopwatch Runtime = new System.Diagnostics.Stopwatch(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, Eve...
2018-12-21 10:23:40
229
原创 C#获取数据库select某一列的值
首先SqlConnection需要引入的命名空间为System.Data.SqlClientpublic static void OpenDateBase() { List<int> idList = new List<int>(); // 数据库连接字符串,database设置为自己的数据库名,以Windows身份验...
2018-12-13 11:30:01
11275
4
原创 C#连接SQL Server 数据库
首先SqlConnection需要引入的命名空间为System.Data.SqlClient string connsql = "server=IP,端口;database=数据库名;uid=sa;pwd=pwd";// "data source=IP;initial catalog=数据库名;user id=sa;pwd=pwd;pooling...
2018-12-13 09:26:21
802
原创 C# 启动带有参数的EXE文件
public static bool StartProcess(string filename, string[] args) { try { string s = ""; foreach (string arg in args) {...
2018-12-12 14:44:58
982
原创 C#获得windows任务栏窗口句柄及一些操作(放大、缩小、关闭、隐藏……)
需调用API函数需在开头引入命名空间using System.Runtime.InteropServices;1、通过窗口名字查找[DllImport("user32.dll", EntryPoint = "FindWindow")]public static extern IntPtr FindWindow(string lp1, string lp2);示例:IntPtr...
2018-12-12 14:36:36
3349
原创 C#获取文件夹下的子文件夹
public static List <string> getDirectory(string path) { List<String> list = new List<string>(); DirectoryInfo root = new DirectoryInfo(path); ...
2018-12-05 12:04:16
5248
原创 C#判断获取的是文件夹还是文件
if(File.Exists(path)){// 是文件}else if(Directory.Exists(path)){// 是文件夹}else{// 都不是}
2018-12-04 22:40:36
4654
1
原创 C#把一个文件夹的复制到另一个文件夹当中
public static class Test { public static void CopyDir(string srcPath, string aimPath) { try { // 检查目标目录是否以目录分割字符结束如果不是则添加 ...
2018-12-04 21:55:24
1916
原创 C#遍历文件夹下子文件
public class ChooseMove { //遍历文件夹 public List<string> FindFile2(string path) { List<String> list = new List<string>(); //遍历文件夹...
2018-12-04 19:17:20
816
原创 windorm选择文件夹
string _path; private void btnChoose_Click(object sender, EventArgs e) { //选择文件夹 FolderBrowserDialog path = new FolderBrowserDialog(); path.S...
2018-12-04 18:07:33
138
原创 unity资源导入preview报错
“BCE0004: Ambiguous reference ‘preview‘: CameraMotionBlurEditor.preview, UnityEditor.Editor.preview.”只需要把preview替换为preview_即可var preview_ : SerializedProperty;preview_ = serObj.FindProperty ("pre...
2018-11-12 23:01:19
443
原创 C#繁体简体互转
//繁体字转简体字 public static string ToSimplifiedChinese(string strTraditional) { string strSimple = Microsoft.VisualBasic.Strings.StrConv(strTraditional, Microsoft.VisualBasic...
2018-10-18 15:25:10
884
原创 C#写入或生成新的TXT文件中
public void CreatTxt() { string str=" "; if (!File.Exists("C:\\Users\\Administrator\\Desktop\\快点我.txt")) { StreamWriter strmsave = new Stre...
2018-10-18 14:56:48
3611
原创 C#读取TXT文件
public void ReadTxt(string path) { StreamReader sr = new StreamReader(path, Encoding.Default); String line; while ((line = sr.ReadLine()) != null) ...
2018-10-18 14:47:59
5137
2
原创 C#去除list中的重复数据
public void CompareList() { for (int i = 0; i < nickNameList.Count; i++) { for (int j = nickNameList.Count-1; j>i ; j--) { ...
2018-10-18 14:46:08
2912
原创 C#只保留字符串数字和汉字(不包括拼音打出来的)
public static List<string> CharacterRemoval() { for (int i = 0; i < nickNameList.Count; i++) { if (Regex.IsMatch(nickNameList[i], "[A-Za-z0-...
2018-10-18 14:44:17
2776
原创 接口实例化
class Program{ static void Main(string[] args) { //C#中COM接口是可以实例化的,但其实这种写法是使接口“映射”到某一个类上,实际上创建的是这个类的实例。 IinterfaceTest test = new IinterfaceTest(); }}[ComImport, CoClas...
2018-09-07 10:15:30
229
原创 unity笔记Json与对象之间的转化
首先导入LitJson类库,编写脚本的时候需要引入using LitJson类库,然后进行操作;1. 把对象转化成 JSON格式字符串: JsonMapper.ToJson2. 把JSON格式字符串转化成对象: JsonMapper.ToObject下面是我自己写的一些简单代码:public class Person{ public string Name { get; s...
2017-10-18 17:04:15
1473
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人