CSVAttribute.cs
1.1 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TSA_V.LoadCSVLibrary
{
//这里利用AttributeUsage 来设置我们的自定义属性的应用范围,这里定义的可以用于类,结构和方法的声明
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class CSVAttribute : Attribute
{
public CSVAttribute(string fieldName,string filedName1, bool IsMust)
{
this.IsMustHave = IsMust;
FieldName = fieldName;
FieldName1 = filedName1;
}
public CSVAttribute(string fieldName,bool IsMust)
{
this.IsMustHave = IsMust;
FieldName = fieldName;
}
public CSVAttribute(string fieldName)
{
FieldName = fieldName;
}
public string FieldName { get; set; }
public string FieldName1 { get; set; }
public bool IsMustHave { get; set; }
}
}