我想编写一个函数,使用以下语法来提取属性名称和类型:
private class SomeClass
{
Public string Col1;
}
PropertyMapper<Somewhere> propertyMapper = new PropertyMapper<Somewhere>();
propertyMapper.MapProperty(x => x.Col1)
有没有一种方法可以在不对此语法进行重大更改的情况下将属性传递给函数?
我想获取属性名和属性类型。
因此,在下面的示例中,我想要检索
Name =“Col1”
和Type =“System.String”
有人能帮忙吗?