<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>XiXingWL - CSharp</title>
    <link>https://sns.xixingwl.cn/forum-44-1.html</link>
    <description>Latest 20 threads of CSharp</description>
    <copyright>Copyright(C) XiXingWL</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Sat, 27 Jun 2026 20:55:55 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>https://sns.xixingwl.cn/static/image/common/logo_88_31.gif</url>
      <title>XiXingWL</title>
      <link>https://sns.xixingwl.cn/</link>
    </image>
    <item>
      <title>C# 之 FileSystemWatcher</title>
      <link>https://sns.xixingwl.cn/thread-338-1-1.html</link>
      <description><![CDATA[FileSystemWatcher 是一个用于监视文件系统变化的类，通常用于检测指定目录或文件中的更改，如创建、删除、重命名或修改等操作。它广泛应用于需要实时响应文件系统变化的场景，如自动化备份、日志监控、文件同步等。
[hr] 1. 主要功能
FileSystemWatcher 可以监视以下类 ...]]></description>
      <category>CSharp</category>
      <author>admin</author>
      <pubDate>Sun, 23 Mar 2025 03:07:02 +0000</pubDate>
    </item>
    <item>
      <title>在C#中，实现多个程序之间的内存共享</title>
      <link>https://sns.xixingwl.cn/thread-337-1-1.html</link>
      <description><![CDATA[在C#中，实现多个程序之间的内存共享和消息循环可以通过 内存映射文件（Memory-Mapped Files） 结合 事件（Event） 或 信号量（Semaphore） 来实现。以下是一个完整的示例，展示如何实现多个程序之间的内存共享和消息循环。
我们可以将共享内存和消息循环的逻辑封装到一 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Thu, 06 Mar 2025 15:31:40 +0000</pubDate>
    </item>
    <item>
      <title>在 C# 中，`Func&lt;&gt;` 和 `Action&lt;&gt;` 是两种常用的委托类型</title>
      <link>https://sns.xixingwl.cn/thread-336-1-1.html</link>
      <description><![CDATA[在 C# 中，`Func` 和 `Action` 是两种常用的委托类型，它们的主要区别在于**返回值**和**用途**。以下是它们的详细对比：

---

### **1. `Action`**

- **定义**：
  - `Action` 是一个泛型委托，用于表示没有返回值的方法。
  - 它可以接受 0 到 16 个输入参数。

- * ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Thu, 06 Mar 2025 07:49:13 +0000</pubDate>
    </item>
    <item>
      <title>写了个在wpf中使用Windows API实现系统托盘图标的类</title>
      <link>https://sns.xixingwl.cn/thread-335-1-1.html</link>
      <description><![CDATA[在WPF中通过Windows API实现系统托盘图标需调用Shell_NotifyIcon及相关Win32函数，以下是具体步骤



调用方法]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 05 Mar 2025 11:00:20 +0000</pubDate>
    </item>
    <item>
      <title>WPF 中几种方式实现托盘图标功能</title>
      <link>https://sns.xixingwl.cn/thread-334-1-1.html</link>
      <description><![CDATA[除了使用 `System.Windows.Forms` 的 `NotifyIcon` 控件外，WPF 中还可以通过以下几种方式实现托盘图标功能：


### 方法 1：使用 WPF 的 `Window` 和 `TaskbarIcon` 第三方库
`TaskbarIcon` 是一个流行的开源库（如 `Hardcodet.NotifyIcon.Wpf`），专门为 WPF 设计，提 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 05 Mar 2025 06:21:38 +0000</pubDate>
    </item>
    <item>
      <title>.net8 C# tcp自定义封包</title>
      <link>https://sns.xixingwl.cn/thread-327-1-1.html</link>
      <description><![CDATA[在里面NET 8，您可以使用TCP套接字创建自定义数据包格式。以下是如何定义自定义数据包格式并通过TCP连接发送/接收数据包的示例：

代码调用

在本例中，我们定义了一个自定义Packet类，该类包含一个标头字节、一个整数ID、一个字符串消息和一个字节数组数据。我们还定义 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 19 Jun 2024 04:10:43 +0000</pubDate>
    </item>
    <item>
      <title>.net8 C# 封包与解包 BinaryFormatter 类已标记为过时</title>
      <link>https://sns.xixingwl.cn/thread-326-1-1.html</link>
      <description><![CDATA[在 .NET 8 中，BinaryFormatter 类已标记为过时，不再建议使用。相反，您可以使用BinaryWriter  和 BinaryReader 类来打包和解压缩数据。下面是在 .NET 8 中打包和解压缩数据的更新示例:如果要解包 你可以使用 BinaryReader 类来处理
 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 19 Jun 2024 03:23:28 +0000</pubDate>
    </item>
    <item>
      <title>C# Socket掉线自动重连</title>
      <link>https://sns.xixingwl.cn/thread-325-1-1.html</link>
      <description><![CDATA[实现 C# 中的网络连接掉线自动重连通常涉及两方面的问题： 检测连接是否丢失和重新建立连接。下面是一个简单的示例，演示了如何实现简单的网络连接掉线自动重连机制：
在上面的示例中，AutoReconnectClient 类负责检测连接是否丢失并重新建立连接。它持续检查连接状态并 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Sat, 15 Jun 2024 09:57:26 +0000</pubDate>
    </item>
    <item>
      <title>C# 异步运行不等待</title>
      <link>https://sns.xixingwl.cn/thread-324-1-1.html</link>
      <description><![CDATA[You want to talk about asynchronous programming in C#! 😊

In C#, asynchronous programming allows you to write code that can perform multiple tasks concurrently, improving the responsiveness and performance of your application. Here are some ways to ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Sat, 15 Jun 2024 09:54:45 +0000</pubDate>
    </item>
    <item>
      <title>C# 操作Hosts 新增修改删除</title>
      <link>https://sns.xixingwl.cn/thread-321-1-1.html</link>
      <description><![CDATA[]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 12 Jun 2024 04:34:20 +0000</pubDate>
    </item>
    <item>
      <title>C# 中对远程机器的网络设置</title>
      <link>https://sns.xixingwl.cn/thread-320-1-1.html</link>
      <description><![CDATA[C# 中可以使用以下方法对远程机器的网络设置：

1. 使用 WMI (Windows Management Instrumentation)

WMI 是 Windows 提供的一种管理接口，可以用来管理和配置远程机器的网络设置。


2. 使用 PowerShell Remoting

PowerShell Remoting 是一种远程管理机制，可以用来 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Sat, 08 Jun 2024 02:30:31 +0000</pubDate>
    </item>
    <item>
      <title>C# 中以使用 System.Net.NetworkInformation 命名空间来配置 IPv4 和 IPv6 网络。下</title>
      <link>https://sns.xixingwl.cn/thread-319-1-1.html</link>
      <description><![CDATA[C# 中可以使用 System.Net.NetworkInformation 命名空间来配置 IPv4 和 IPv6 网络。下面是一些示例代码：

获取网络接口


设置 IPv4 地址


设置 IPv6 地址


设置 DNS 服务器

设置网关


禁用/启用网络接口


注意：以上代码仅供参考，实际实现中需要根据具体情况进 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Sat, 08 Jun 2024 02:27:08 +0000</pubDate>
    </item>
    <item>
      <title>C# 获取网络适配器</title>
      <link>https://sns.xixingwl.cn/thread-318-1-1.html</link>
      <description><![CDATA[C# 中有多种方式可以获取网络适配器，以下是一些常见的方法：

使用 System.Net.NetworkInformation 命名空间

使用 System.Management 命名空间

使用 System.Net.Sockets 命名空间

使用 WMI (Windows Management Instrumentation)

使用 System.Linq 和 System.Net.N ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Sat, 08 Jun 2024 02:19:01 +0000</pubDate>
    </item>
    <item>
      <title>C# 管理员身份执行cmd任务</title>
      <link>https://sns.xixingwl.cn/thread-317-1-1.html</link>
      <description><![CDATA[C# 中有多种方式来以管理员身份执行 cmd 任务，下面都是可行的解决方案：

使用 Process 类

在上面的代码中，我们创建了一个新的 Process 对象，并设置了命令和参数。我们使用 Verb 属性将命令设置为以管理员身份运行，然后启动进程并读取输出。

使用 Elevate 类库
u ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Fri, 07 Jun 2024 09:08:44 +0000</pubDate>
    </item>
    <item>
      <title>wpf RichTextBox绑定</title>
      <link>https://sns.xixingwl.cn/thread-316-1-1.html</link>
      <description><![CDATA[WPF 的 RichTextBox 是一个比较特殊的控件，它的内容通常是通过 FlowDocument 来管理的，而不是直接绑定文本属性。要在 RichTextBox 中绑定内容，你需要创建一个 FlowDocument 对象，并在其中添加你的内容。

下面是一个示例，演示如何通过绑定来更新 RichTextBox 的内 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Thu, 06 Jun 2024 09:26:39 +0000</pubDate>
    </item>
    <item>
      <title>C# 字符转转数组 换行符分割</title>
      <link>https://sns.xixingwl.cn/thread-315-1-1.html</link>
      <description><![CDATA[C# 中有多种方式可以按行读取文本，以下是其中的一些：

使用 File.ReadLines 方法
这将逐行读取文件并将每行输出到控制台。

使用 StreamReader 类

这将逐行读取文件并将每行输出到控制台。

使用 File.ReadAllLines 方法

这将将整个文件读取到内存中，然后逐行输出 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Thu, 06 Jun 2024 09:25:17 +0000</pubDate>
    </item>
    <item>
      <title>在 WPF 中，如果实时更新 GridView（或者称为 DataGrid）的数据</title>
      <link>https://sns.xixingwl.cn/thread-314-1-1.html</link>
      <description><![CDATA[在 WPF 中，如果想要实时更新 GridView（或者称为 DataGrid）的数据，可以考虑使用绑定的方式，并且在数据源发生变化时通知界面更新。以下是一个简单的示例代码，演示如何实时更新 GridView 的数据：假设你有一个 ViewModel 如下：

创建一个简单的数据模型 MyData：

 ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 05 Jun 2024 01:31:17 +0000</pubDate>
    </item>
    <item>
      <title>在C# WPF 中，可以通过使用 Microsoft Office Interop 框架来导入 Excel 数据</title>
      <link>https://sns.xixingwl.cn/thread-313-1-1.html</link>
      <description><![CDATA[在 WPF 中，可以通过使用 Microsoft Office Interop 框架来导入 Excel 数据。以下是一个简单的示例代码，演示如何在 WPF 应用程序中导入 Excel 数据：

在这个示例中，我们使用 Microsoft Office Interop 框架打开一个 Excel 文件，读取工作表中的数据，并将数据以 Mess ...]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 05 Jun 2024 01:28:53 +0000</pubDate>
    </item>
    <item>
      <title>C#添加删除（程序、端口）防火墙例外</title>
      <link>https://sns.xixingwl.cn/thread-38-1-1.html</link>
      <description><![CDATA[C#添加删除防火墙例外（程序、端口）
一、 添加 COM 引用在引用里，选择 COM 页， 找到 NetFwTypeLib , 确定即可二、 添加允许通过防火墙的例外程序]]></description>
      <category>CSharp</category>
      <author>admin</author>
      <pubDate>Wed, 07 Jun 2023 15:05:05 +0000</pubDate>
    </item>
    <item>
      <title>使用C#调用系统API实现内存注入</title>
      <link>https://sns.xixingwl.cn/thread-25-1-1.html</link>
      <description><![CDATA[这里以记事本为例]]></description>
      <category>CSharp</category>
      <author>shiy720</author>
      <pubDate>Wed, 28 Dec 2022 01:52:50 +0000</pubDate>
    </item>
  </channel>
</rss>