const肯定不等于readonly。当然,他们是相似的,在有限的范围内,但并非完全相同。尝试这样做: const MyClass mc = new MyClass(); const is certainly not the equivalent of readonly. Sure, they''re similar, toa limited extent, but not at all the same. Try doing this:const MyClass mc = new MyClass(); " ... readonly真正含义..."?不 - 你已经描述了''readonly''可能使用的'b $ b'。 readonly的意思是,一旦赋值, 就不能重新分配。这就是它的全部意味着。你已经描述了使用''readonly''的一个 可能的意图,但肯定不是唯一的原因。 关于*的细节没有任何意义为什么*我想做一个本地的 readonly。似乎没有充分的理由说明为什么我不能给b . "...what readonly really means..."? No -- you have described one possibleuse of ''readonly''. What readonly means is that once a value is assigned itcannot be re-assigned. That''s all it "means". You have described onepossible intention of using ''readonly'', but certainly not the only reason.There''s no sense in going into details as to *why* I want to make a localreadonly. It just seems that there''s no good reason why I shouldn''t be ableto. 少合法?什么都没有不太合法关于它。 "Less legal"? There''s nothing "less legal" about it. 是的,谢谢。我自己发现了这个。这就是我的要求。 你基本上重新措辞了我已经说过的话。 Yes, Thank you. I''ve discovered this myself. That''s what I was asking about.You basically re-phrased what I''d already stated. 这篇关于??基本的C#语言问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 20:46