gpt4 book ai didi

c# - C# 类库中对象的类、方法、变量大小写/名称的最佳实践是什么?

转载 作者:太空宇宙 更新时间:2023-11-03 21:14:18 25 4
gpt4 key购买 nike

<分区>

我是一些小众语言的强大开发人员,并且正在有机地学习 C#,因此尝试学习最佳实践。

我能否获得一些关于以下示例代码块的最佳反馈,例如,我正在构建 Shopify 集成。

namespace WMShopify
{
// Is it common to have the namespace and class the same?
public class WMShopify
{
// Are there different practices for private/public vars?
public string APIKey { get; set; } // Capital
public string password { get; set; } // lower case
public string secretString { get; set; } // Camel
private string _combinedVar; // Camel/underscore for private
}

// Should these be in a separate *.cs file?
public class WMShopifyOrders
{
// Method capital/lower/camel?
public int getOrderCount()
{
// lower/capital/camel?
int localMemberVar = 0;

return localMemberVar;
}
}

// Should these be in a separate *.cs file?
public class WMShopifyProducts
{
public List<string> getProductList()
{
return new List<string>();
}
}
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com