简体   繁体   English

在C#中创建Powershell CmdLets-为什么不使用自动实现的属性

[英]Creating Powershell CmdLets in C# - why not use auto-implemented properties

Very simple question: 很简单的问题:

In all of the examples I've seen, cmdlets never take advantage of auto-implemented properties for the cmdlet parameters, is there any genuine reason for not using auto-implemented properties? 在我看到的所有示例中,cmdlet从未利用cmdlet参数的自动实现属性,是否有真正的理由不使用自动实现属性?

I don't think there's any reason why you couldn't use auto-implemented properties. 我认为没有任何原因不能使用自动实现的属性。 I have and it seems to work fine. 我有,它似乎工作正常。 My guess would be that a lot of example code was just written pre-C# 3.0 and they had to do it by hand. 我的猜测是很多示例代码只是在C#3.0之前编写的,因此他们必须手工完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM