Can parameters be constant?

后端 未结 9 1527
终归单人心
终归单人心 2020-12-24 04:39

I\'m looking for the C# equivalent of Java\'s final. Does it exist?

Does C# have anything like the following:

public Fo         


        
9条回答
  •  不思量自难忘°
    2020-12-24 05:05

    Here's a short and sweet answer that will probably get a lot of down votes. I haven't read all of the posts and comments, so please forgive me if this has been previously suggested.

    Why not take your parameters and pass them into an object that exposes them as immutable and then use that object in your method?

    I realize this is probably a very obvious work around that has already been considered and the OP is trying to avoid doing this by asking this question, but I felt it should be here none-the-less...

    Good luck :-)

提交回复
热议问题