- 博客(15)
- 资源 (5)
- 收藏
- 关注
原创 c# post传文件
byte[] fileContentByte = new byte[10240]; // 文件内容二进制#region 将文件转成二进制FileStream fs = new FileStream("fastreport\\" + templateName, FileMode.Open, FileAccess.Read);fileContentByte = new byte[fs.Length]; // 二进制文件fs.Read(fileContentByte, 0, Convert.ToI
2021-08-11 17:13:36
1566
原创 c# 重启程序
重启1,有时会报错System.Windows.Forms.Application.Restart();重启2,稳定public void Restart(){//开启新的实例Process.Start(Application.ExecutablePath);//关闭当前实例Process.GetCurrentProcess().Kill();}Application.Exit();//退出当前项目,如果是子项目,则不会停止主项目System.Environm
2021-08-11 17:11:10
604
原创 c# 判断重复启动
Process[] processcollection = Process.GetProcessesByName("ZillionSoft.Workstation.Desktop");//获取指定的进程名if (processcollection.Length > 1) //如果可以获取到知道的进程名则说明已经启动{//MessageBox.Show("程序已启动2!");System.Environment.Exit(0);}...
2021-08-11 17:09:05
667
原创 c# 调用浏览器打开页面
using System;using System.Diagnostics;using System.IO;using System.Windows.Forms;using Microsoft.Win32;namespace WindowsFormsApplication1{public class BrowserHelper{/// <summary>/// 调用系统浏览器打开网页/// http://m.jb51.net/article/446
2021-08-11 17:07:33
2471
原创 c# 修改本地配置文件不删注释的方法
public static void SaveAppSettingsMethod2(string key, string value){//验证key value//To DoXmlDocument xml = new XmlDocument(); string configPath = Application.ExecutablePath + ".config";xml.Load(configPath);XmlNodeList nodeList = xml..
2021-03-04 14:02:05
486
1
原创 c# 关于配置文件
读当前项目配置文件string heightWeightFlag = ConfigurationSettings.AppSettings["heightWeightFlag"];读非当前项目配置文件string path = System.AppDomain.CurrentDomain.BaseDirectory;if (File.Exists(path + "../ZillionReport.exe.config"))//判断是否存在{ExeConfigurationFileMap
2021-03-04 13:59:24
252
1
原创 c#中对文件的简单操作
新建文件夹:if (!Directory.Exists(sPath))//判断是否存在{Directory.CreateDirectory(sPath);//新建文件夹}递归删除文件夹及内容if (Directory.Exists(dir)) //如果存在这个文件夹删除之{foreach(string d in Directory.GetFileSystemEntries(dir)){if(File.Exists(d))File.Delete(d); //直接删除
2021-03-04 13:53:51
253
1
原创 c#中计算字符串中子串出现的次数
static int SubstringCount(string str, string substring) { if (str.Contains(substring)) { string strReplaced = str.Replace(substring, ""); return (str.Length - strReplaced.Length) / substring.Length; } return 0; }
2021-03-04 13:52:10
639
1
原创 C# 注册dll的两种方式
普通注册string path = System.AppDomain.CurrentDomain.BaseDirectory ;System.Diagnostics.Process p = System.Diagnostics.Process.Start("regsvr32", path + "DicomObjects.ocx");管理员注册private bool RegisterDll(String dllPath){bool result = true;try{.
2021-03-04 13:49:44
1954
1
转载 springmvc 注解
@RequestMapping("checkIndentsub") 匹配@ResponseBody返回结果不会被解析为跳转路径,而是直接写入HTTP response body中。比如异步获取json数据,加上@responsebody后,会直接返回json数据。
2017-09-25 11:21:43
234
转载 map遍历的几种方法
importjava.util.ArrayList;importjava.util.HashMap;importjava.util.Iterator;importjava.util.List;importjava.util.Map;importjava.util.Set;一: System.out.println("方法一"); Iterator it = tempMap.e
2017-09-25 11:12:34
326
原创 获取GUID(全局唯一标识符)
import java.util.UUID;UUID uuid = UUID.randomUUID();System.out.println(".{"+uuid.toString()+"}");
2017-09-25 11:08:57
3515
原创 对list中的实体类或map重新排序
import java.util.Collections;import java.util.Comparator;Collections.sort(list, new Comparator() { @Override public int compare(Object o1, Object o2) { VOCustomerInfo vo1 = (VOCustomerInfo) o1;
2017-09-25 11:05:50
346
转载 关于double计算精度丢失解决办法
import java.math.BigDecimal;public class Arith { // 源文件Arith.java: /** * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精 确的浮点数运算,包括加减乘除和四舍五入。 */ // 默认除法运算精度 private static final int DEF_DIV_SCALE = 10;
2017-09-25 11:03:37
5140
原创 一串数字分区间显示
将一个list[2,1,3,5,6,7,8,10,12,14,16,17,18,19,21], 变成 1-3,5-8,10,12,14,16-19,21
2017-09-25 10:59:02
722
Interop.FastReport.dll
2020-11-25
绵阳市医保支付接口规范(v3.3)2020-01-14修改(1).doc
2020-03-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人