本文介绍了C#的CodeDOM自动属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有CodeDom中创建一个属性。我怎样才能将它设置为是一个自动属性,而不是添加CodeFieldReferenceExpressions针对私有成员?

I have a property created with CodeDom. How can I set it to being an automatic property instead of adding CodeFieldReferenceExpressions against a private member?

推荐答案

IIRC,CodeDom中根本没有按'吨有表达该的方法。自动实现的属性只是编译糖,但由于它不映射(干净),以所有语言,它不干净适合的CodeDOM(此外,CodeDom中本来需要更新)。

IIRC, CodeDom simply doesn't have a way of expressing this. Automatically implemented properties are just compiler sugar, but since it doesn't map (cleanly) to all languages, it doesn't fit cleanly into CodeDom (besides, CodeDom would have needed an update).

这篇关于C#的CodeDOM自动属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 13:19