gpt4 book ai didi

.net - 属于T还是属于TEntity?

转载 作者:行者123 更新时间:2023-12-01 23:08:52 24 4
gpt4 key购买 nike

我知道这可能是一个愚蠢的问题,但是泛型的命名标准是什么?

Of t 或 Of TEntity 或 Of... 这真的无关紧要吗?

我看到 IQueryable(Of T) 然后是 DBSet(Of TEntity)。

最佳答案

微软制造 following recommendations in Generics FAQ: Best Practices :

Name generic type parameters with descriptive names, unless a single letter name is completely self explanatory and a descriptive name would not add value. [...] If you have no additional contextual information about the type parameter, you should use the letter T.


Public Class SomeClass(Of T)

Public Interface ISessionChannel(Of TSession)

我通常遵循 Microsoft 的命名约定,除非我有很好的理由不这样做,因为很多其他开发人员也这样做,并且很容易在不同的代码库中移动。

关于.net - 属于T还是属于TEntity?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5321401/

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