添加/设置新自定义属性的反射

时间:2015-08-16 23:31:50

标签: .net vb.net

我试图找到一种在运行时添加新自定义属性的方法,我意识到这可能是不可能的,所以我会满足于通常添加客户属性,我想尝试覆盖/设置大小

我的课就是这个

Public Class POCO1

    <StringLength(15)>
    Property FirstName As String

    Property LastName As String

End Class

我想尝试像

这样的东西
Dim lName As StringLengthAttribute = New StringLengthAttribute(50)

Dim last As PropertyInfo = this.GetProperty(("lastName")).Add(lName)

0 个答案:

没有答案
相关问题