大端 小端 大端模式就是数据从高字节到低字节在内存中排列,小端模式就是数据从低字节到高字节在内存中排列,数据本身字节是高字节在左,低字节在右。32bit宽的数0x12345678在Little-endian模式CPU内存中的存放方式(假设从地址0x4000开始存放)为: 内存地址 0x4000 0x4001 0x4002 0x4003 存放内容 0x78
C# SignalR IProgress<int> 实现IProgress<in T>接口的Progress<int T>类,接收一个Action<T>,通过这个委托显示进度。服务器端: public async Task<string> ALongTimeTask() { //方法1 //var p = new Progress<int>(); //p.ProgressChanged += (a,...
记录:EventLoopScheduler实现定时调度任务 EventLoopScheduler Class (System.Reactive.Concurrency) | Microsoft Docs参考微软的官方文档。EventLoopScheduler可以实现定时调度任务。public static IDisposable Schedule(this IScheduler scheduler, TimeSpan dueTime, Action action);如果在action的最后再调用一次同样的Schedule,就可以实现循环了。...
C# Subject System.Reactive.Subjects 及节流阀实现 System.Reactive.Subjects里的Subject实现了观察者和被观察者的接口。可以使用OnNext(T val)发布通知;可以通过SubScribe(new Action<T>(function))可以订阅该数据T.
WPF 手动内存释放 实际 效果还可以GC.Collect(); // find finalizable objects GC.WaitForPendingFinalizers(); // wait until finalizers executed GC.Collect(); // collect finalized objects
WPF,根据文字长度调整自定义的 Dialog宽度 转自:WPF,计算绘制一段文字需要多少宽度 - 奇迹之耀 - 博客园 (cnblogs.com) private double GetTextWidth(string text) { var textBlock = new TextBlock{ Text = text, TextWrapping = TextWrapping.NoWrap, FontSize = 14 }; textBlock.Mea...
WPF TimeSpan 进行 xml序列化始终为空值的问题 参考:c# - How to serialize a TimeSpan to XML - Stack Overflow // Local Variable private TimeSpan mDuration; // Public Property - XmlIgnore as it doesn't serialize anyway [XmlIgnore] public TimeSpan Duration ...
WPF TextBox MaxLines 未生效 参考:wpf - MinLines and MaxLines on TextBox not working - Stack Overflow顶一个Height或者MinHeight或MaxHeight属性后,MaxLines就失效了。
XDocument 写入 (带namespace)XML XDocument xmlDoc = new XDocument();//全局的namespace单独定义 会在第一次使用时写入xml XNamespace xn = "http://xxx1"; xmlDoc.Declaration = new XDeclaration(new XDeclaration("1.0", "utf-8", "")); XElement root = new XElement(x...
OpenFileDialog / SaveFileDialog的简单使用,及左上角的图标设置 点击项目,右键属性,在图标中,浏览选择图标。设置完成后。引用 Microsoft.Win32。打开文件: OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Select File to Import"; dlg.DefaultExt = ".xx"; dlg.Ini...
BufferedReader 读取中文乱码 InputStreamReader isr = new InputStreamReader(new FileInputStream("D:\\File_sum\\新建文本文档.txt"),"GBK");//使用UTF-8还是乱码 使用GBK中文显示就正常了 BufferedReader br= new BufferedReader(isr); String s = null; StringBuilder sBuilder = new Strin...
Thrift 获取客户端ip C# 看了网上很多资料,有Java,C++,Python版本的。我以为是类似的,找着做,发现根本行不通。为取得客户端的IP,有三个办法(转自网上查到资料):1)网上博文http://blog.csdn.net/hbuxiaoshe/article/details/38942869介绍的方法也是可行的,不过让人有些纠结;2)修改Thrift的实现,为TServerEventHandler:...
wpf RichTextBox的使用(总结) 今天就想在Textbox上显示Error的信息的时候,字体变红色,发现并不支持。所以研究了下RichTextBox。留着以后备用。(1) 设置行间距: <RichTextBox Height="255" HorizontalAlignment="Left" Margin="0,25,-0.2,0" Name="txtMessage" VerticalAlignm...
C# tcp 服务器端 + 安卓TCP客户端- 简单例子 都是网上找的简答的例子,实现自己想要的功能。留着以后备用。C#:服务器端,使用的是简单地TcpListener : static void Main(string[] args) { TcpListener server = null; Console.Write("请输入监听的端口号:"); ...
c++ .exe cmd 命令行运行 带指定参数(最蠢的方法) #include <stdio.h>#include <stdlib.h>#include <unistd.h>#include<iostream>#include<string>using namespace std;int main(int argc, char **argv){ string inputCoi...