XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension

【DLL】XFE各类拓展是一个C#的DLL库,旨在优化C#代码中常用语句的使用,并提供更简洁的访问方式,同时提供Xunit测试框架,快速搭建服务器/客户端,免费ChatGPTAPI接口,免费通讯服务器,XFE下载器,新增格式等

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension

新增委托拓展: 使用XFE委托事件即可使得sender具有具象的泛型,便于接收

55d5c56
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

3 个文件 +27 -2
Added XFE各类拓展/DelegateExtension.cs +23 -0
@@ -0,0 +1,23 @@
1 namespace XFE各类拓展.DelegateExtension
2 {
3 /// <summary>
4 /// 指定发送者泛型的委托事件
5 /// </summary>
6 /// <typeparam name="T">发送者泛型</typeparam>
7 /// <param name="sender">发送者</param>
8 public delegate void XFEEventHandler<T>(T sender);
9 /// <summary>
10 /// 指定发送者泛型的委托事件
11 /// </summary>
12 /// <typeparam name="T1">发送者泛型</typeparam>
13 /// <typeparam name="T2">事件参数泛型</typeparam>
14 /// <param name="sender">发送者</param>
15 /// <param name="e">事件参数</param>
16 public delegate void XFEEventHandler<T1, T2>(T1 sender, T2 e);
17 /// <summary>
18 /// 委托事件拓展
19 /// </summary>
20 public static class DelegateExtension
21 {
22 }
23 }
Modified XFE各类拓展/XCCNetWork.cs +3 -2
@@ -8,6 +8,7 @@ using System.Threading;
8 8 using System.Threading.Tasks;
9 9 using XFE各类拓展.ArrayExtension;
10 10 using XFE各类拓展.BufferExtension;
11 using XFE各类拓展.DelegateExtension;
11 12 using XFE各类拓展.FormatExtension;
12 13 using XFE各类拓展.TaskExtension;
13 14
@@ -881,7 +882,7 @@ namespace XFE各类拓展.CyberComm.XCCNetWork
881 882 /// <summary>
882 883 /// 文件加载完成时触发
883 884 /// </summary>
884 public event EventHandler<byte[]> FileLoaded;
885 public event XFEEventHandler<XCCFile> FileLoaded;
885 886 /// <summary>
886 887 /// 群组ID
887 888 /// </summary>
@@ -918,7 +919,7 @@ namespace XFE各类拓展.CyberComm.XCCNetWork
918 919 {
919 920 FileBuffer = fileBuffer;
920 921 Loaded = true;
921 FileLoaded?.Invoke(this, fileBuffer);
922 FileLoaded?.Invoke(this);
922 923 }
923 924 /// <summary>
924 925 /// XCC文件
Modified XFE各类拓展/XFE各类拓展.csproj +1 -0
@@ -57,6 +57,7 @@
57 57 <Compile Include="AttributeExtension.cs" />
58 58 <Compile Include="BufferExtension.cs" />
59 59 <Compile Include="CyberComm.cs" />
60 <Compile Include="DelegateExtension.cs" />
60 61 <Compile Include="FileExtension.cs" />
61 62 <Compile Include="ListExtension.cs" />
62 63 <Compile Include="MailExtension.cs" />