I have a method named IsDone. This method does some checks and returns true or false.

Is there any benefit in using a Property without a setter instead?


If you don't modify the internal state and the checks does not have a lot of overhead a property is more appropriate. This article from MSDN provides some good guidelines to choose method vs property https://msdn.microsoft.com/en-us/library/ms229054(v=vs.100).aspx

| improve this answer | |
  • What about this new way in C# 6? the => ? dont know whats called that's why I did not put it in the question – John Demetriou Jul 8 '16 at 7:51
  • 1
    @JohnDemetriou If you mean creating a function/property body with the => syntactic sugar, that's called Expression bodied function (or property). I believe in C# the fat-arrow (=>) symbol itself is mostly associated with lambda expressions. – Andy Jul 8 '16 at 7:55
  • I know about Lambdas. Its just the latest resharper keeps suggesting get only properties to use that. But I guess yeah, it a lambda expression for the property. Cool Thanks – John Demetriou Jul 8 '16 at 8:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.