小编Fre*_*nkR的帖子

访问C#属性名称或属性

我想从类实例中自动生成SQL语句.该方法应该看起来像Update(object []属性,对象PrimaryKeyProperty).该方法是实例的一部分(类,基本方法 - 任何子代的通用).属性数组是类属性的数组,将在update语句中使用.属性名称等于表字段名称.

问题是我无法获得属性名称.

有没有选项在类实例中获取属性名称?样品:

public class MyClass {
public int iMyProperty { get; set; }
public string cMyProperty2 { get; set; }
{

main() {
 MyClass _main = new MyClass();

_main.iMyProperty.*PropertyName* // should return string "iMyProperty"

{
Run Code Online (Sandbox Code Playgroud)

我知道PropertyInfo,但我不知道从GetProperties()数组中获取属性的ID.

有什么建议吗?

c# properties

14
推荐指数
3
解决办法
2万
查看次数

cf.net app protection(antidebug,obfuscate)

是否有任何开箱即用的解决方案可以保护cf.net(3.5)软件免受逆向工程和未经许可的再分发(平均黑客保护)?打包机/本机包装的任何选项?

.net obfuscation compact-framework copy-protection

6
推荐指数
1
解决办法
558
查看次数