随笔分类 -  C#

摘要:1.在你的工程中,添加app.config文件。文件的内容默认为: <?xml version="1.0" encoding="utf-8" ?> <configuration> </configuration> 2.如果你想给程序配置一些参数,就在标签中添加.例如: <?xml version=" 阅读全文
posted @ 2025-01-07 14:10 超级驼鹿 阅读(31) 评论(0) 推荐(0) 编辑
摘要:1.资源 <Window.Resources> <Style x:Key="TabStyle" TargetType="TabItem"> <Setter Property="TextBlock.FontSize" Value="12" /> <Setter Property="Template"> 阅读全文
posted @ 2024-12-26 11:26 超级驼鹿 阅读(3) 评论(0) 推荐(0) 编辑
摘要:绿色部分可以动态调整高度: <Grid Height="450" Width="800"> <Viewbox> <Canvas Width="20" Height="20"> <Path Data="M5.39285714,9.10714286 L5.39285714,9.64285714 C5.3 阅读全文
posted @ 2024-03-21 15:24 超级驼鹿 阅读(39) 评论(0) 推荐(0) 编辑
摘要:1.VS中右键App.xaml,【生成操作】选择为【Page】 2.修改App.xaml.cs文件如下: using System; using Microsoft.Extensions.DependencyInjection; using System.Threading; using Syste 阅读全文
posted @ 2024-01-15 10:33 超级驼鹿 阅读(112) 评论(0) 推荐(0) 编辑
摘要:<ItemsControl ItemsSource="{Binding MemberList}" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Vi 阅读全文
posted @ 2023-10-24 10:10 超级驼鹿 阅读(588) 评论(0) 推荐(0) 编辑
摘要:原始写法: 方案一 方案二 阅读全文
posted @ 2023-10-08 08:27 超级驼鹿 阅读(42) 评论(0) 推荐(0) 编辑
摘要:这个鱼真舒服呀~ 1.Invoke 是一个方法,方法一定要用对象来调用 2.使用 Invoke 的两种情况,控件 Control.Invoke 和 委托 Delegate.Invoke 3.控件情况下,解决跨线程访问控件,例如操作 Lable 控件添加内容,使用 able.Invoke 即可 4.委 阅读全文
posted @ 2023-09-12 01:18 超级驼鹿 阅读(39) 评论(0) 推荐(0) 编辑
摘要:public void SaveLensDisRet(string fileContent) { var filePath = Directory.GetCurrentDirectory() + "\\data\\LensDisRet\\"; if (!Directory.Exists(filePa 阅读全文
posted @ 2023-08-03 11:11 超级驼鹿 阅读(15) 评论(0) 推荐(0) 编辑
摘要:许久没有发表这么有含金量的博客,深感欣慰。 阅读全文
posted @ 2023-04-10 17:34 超级驼鹿 阅读(128) 评论(0) 推荐(0) 编辑
摘要:class Program { [DllImport("user32.dll")] public static extern int DeleteMenu(IntPtr hMenu, int nPosition, int wFlags);// 删除菜单 [DllImport("user32.dll" 阅读全文
posted @ 2022-08-03 10:43 超级驼鹿 阅读(30) 评论(0) 推荐(0) 编辑
摘要:2022.5.1今天加班 Base64->图片 byte[] bit = Convert.FromBase64String(ret.data.oauthMPCode); using (MemoryStream ms = new MemoryStream(bit)) { Bitmap bmp = ne 阅读全文
posted @ 2022-05-01 14:16 超级驼鹿 阅读(487) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Console.WriteLine("(54/10):{ 阅读全文
posted @ 2022-01-06 11:08 超级驼鹿 阅读(44) 评论(0) 推荐(0) 编辑
摘要:1、Json转换为XML XmlDocument docj = JsonConvert.DeserializeXmlNode(strJson); string resultText = docj.OuterXml; 2、Xml转换为Json XmlDocument doc = new XmlDocu 阅读全文
posted @ 2021-12-07 17:00 超级驼鹿 阅读(377) 评论(0) 推荐(0) 编辑
摘要:1.需要解析的XML字符串,获取 BookedInfo 集合 string xmlStr = @"<Request> <BookedInfos> <BookedInfo> <CHARGECODE> 收费项编码 </CHARGECODE> <HISDEPTCODE> His科室代码 </HISDEPT 阅读全文
posted @ 2021-09-07 14:20 超级驼鹿 阅读(538) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// 两个对象中相同属性赋值,R代表目标实体,T代表数据源实体 /// </summary> public static R MappingObject<R, T>(R newData,T oldData) { if (newData == null) { newDat 阅读全文
posted @ 2021-08-05 15:20 超级驼鹿 阅读(334) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// 设置对象中为空的属性值,即对象的所有属性均有值(集合数组属性不能设置) /// </summary> /// <typeparam name="T"></typeparam> /// <param name="source">数据源</param> /// <pa 阅读全文
posted @ 2021-07-08 08:42 超级驼鹿 阅读(102) 评论(0) 推荐(0) 编辑
摘要:1.封装被调用库 public delegate string CallBack(string message); public int MyInterfance(CallBack cb) { return cb("张天才"); } 2.使用调用库 int ret = MyInterfance(ca 阅读全文
posted @ 2021-06-10 18:26 超级驼鹿 编辑
摘要:反射+泛型方法 public static bool ObjectIsNullOrEmpty<T>(T t) { foreach (var item in t.GetType().GetProperties()) { if (item.GetValue(t) == null) { return tr 阅读全文
posted @ 2021-05-26 10:34 超级驼鹿 阅读(1097) 评论(0) 推荐(0) 编辑
摘要:设计模式一套被反复使用,多数人知晓的代码设计经验的总结,实现可重用代码,使代码更容易被理解,保证代码可靠性。 总体来说,设计模式分为三大类: 创建型模式(五种):工厂方法模式、抽象工厂模式、单例模式、建造者模式、原型模式 结构型模式(七种):适配器模式、装饰器模式、代理模式、外观模式、桥接模式、组合 阅读全文
posted @ 2021-03-26 13:32 超级驼鹿 阅读(100) 评论(0) 推荐(0) 编辑
摘要:一个类继承了某个抽象类表示它“是什么”,实现了某个接口表示它“有什么功能”或者“会做什么事”。比如:燕子(具体类)是鸟(抽象类),会飞(接口)。C#中不支持多继承,即燕子只能是鸟,不会是其他东西了;但可以有多个功能,做很多事,比如会飞(IFly),会吃(IEat)。 阅读全文
posted @ 2021-03-26 10:31 超级驼鹿 阅读(49) 评论(0) 推荐(0) 编辑

/*
点击右上角即可分享
微信分享提示