随笔分类 - C#
摘要:1.如果数据仅用于展示,或者对数据的获取没有先后要求,可以使用如下线程 private void AutoUpdate_Loaded(object sender, RoutedEventArgs e) {Thread ThreadUpdate = new Thread(Update);} priva
阅读全文
摘要:1.根目录 string selectedPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\MaterialFiles"; if (!File.Exists(selectedPath)) { System.IO.Directory.Creat
阅读全文
摘要:1.Linq中自带的计算方法:Sql. 。 2.GroupBy 用法 OcSheetNameInfo = OcFlowCheckTableNameConfig .GroupBy(flowBase => flowBase.FunctionTableName) .Select(S => new Flow
阅读全文
摘要:public static bool IsNumber(string s) { if (string.IsNullOrWhiteSpace(s)) return false; const string pattern = "^[0-9]*$"; Regex rx = new Regex(patter
阅读全文
摘要:1.变量基本属性及反序列化 using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; na
阅读全文
摘要:第一步 (C中)创建 第二步:(A中)声明、绑定 第三步:(B中)触发 方法 第三步:(A中)绑定的方法
阅读全文
摘要:?.表示如果不为空LoginUserCode = s.Element("LoginUserCode") != null ? s.Element("LoginUserCode").Value:string.Empty,>> LoginUserCode = s.Element("LoginUserCod
阅读全文
摘要:从字典(DicRoleForScope)中查询对应(role)的值再赋值给其他变量( DicSelectedRoleForScope) Dictionary<string, object> dic = DicRoleForScope.Where(s => s.Value.ToString().Con
阅读全文
摘要:数据处理 1、保留两位小数 = float.Parse(数据).ToString("F2") //不准确 例如9.57转换后变为9.60 四舍五入 Math.Round(变量, 位数, MidpointRounding.AwayFromZero).ToString() 2、numeric(18, 2
阅读全文
摘要:一 . hashTable 1.引用 using System.Collections; 2.声明 Hashtable ht = new Hashtable(); 3.添加值 ht.Add(key,value); key 唯一 string keytxt = de.Key.ToString() st
阅读全文
摘要:1.App.config 文件中定义 <!--记忆语言--> <appSettings> <add key="languageRemember" value="2052" /> </appSettings> 2.关闭时保存本次登机的语言选择 // 记忆退出时的语言类型 Communication.C
阅读全文
摘要:1. 根据地址打开文件 AppDomain.CurrentDomain.BaseDirectory Application.StartupPath // 根路径 :即进入到项目的Debug层 System.Diagnostics.Process.Start(@"Help\操作说明.docx"); /
阅读全文