上传了新的示例工程

This commit is contained in:
fengjiayi
2024-09-27 10:30:19 +08:00
parent 54c35ce445
commit f3a90df452
24 changed files with 1062 additions and 127 deletions

View File

@@ -73,6 +73,30 @@ namespace Serein.Library.Attributes
}
}
/// <summary>
/// 枚举值转换器要求枚举项标记的BindValueAttribute特性与搭配的参数类型一致否则参数不会传入
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public class EnumTypeConvertorAttribute : Attribute
{
public Type EnumType { get; }
public EnumTypeConvertorAttribute(Type @enum)
{
if (@enum.IsEnum)
{
EnumType = @enum;
}
else
{
throw new ArgumentException("需要枚举类型");
}
}
}
[AttributeUsage(AttributeTargets.Field)]
public class PLCValueAttribute : Attribute
{
@@ -121,27 +145,4 @@ namespace Serein.Library.Attributes
}
}
/// <summary>
/// 枚举值转换器
/// </summary>
//[AttributeUsage(AttributeTargets.Parameter)]
//public class EnumConvertorAttribute : Attribute
//{
// public Type Enum { get; }
// public EnumConvertorAttribute(Type @enum)
// {
// if (@enum.IsEnum)
// {
// Enum = @enum;
// }
// else
// {
// throw new ArgumentException("需要枚举类型");
// }
// }
//}
}