09 2022 档案
摘要:约束 说明 where T:struct 对于结构约束,类型T必须是值类型 where T:class 类约束指定类型T必须是引用类型 where T:IFoo 指定类型T必须实现接口IFoo where T:Foo 指定类型T必须派生自基类Foo where T:new() 这是一个构造函数约束,
阅读全文
摘要:原来获取本机IP地址的方法(方法1): var items = Dns.GetHostEntry(Dns.GetHostName()).AddressList .Where(s => s.AddressFamily == System.Net.Sockets.AddressFamily.InterN
阅读全文
摘要:模板样式定义: <TabControl ItemsSource="{Binding Items}"> <TabControl.ContentTemplate> <DataTemplate> <ListBox BorderThickness="0" ItemsSource="{Binding Item
阅读全文
摘要:数据的导出: private void OnExport() { try { FolderBrowserDialog dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogR
阅读全文
摘要:用小工具自动生成一段XAML代码,但是自动生成的文本缩进和格式比较乱,想弄得整齐一点。 附上最终的实现代码: public static string FormatXML(string content) { XmlDocument doc = new XmlDocument(); XmlReader
阅读全文