help
Root Question Message
public void Start()
method. But this method may be dependent on the property public EngineType EngineType { get; set; }
. This would be stateful because you can't perform that action without some knowledge about the object.{get; set}
do yetpublic int Add(int a, int b)
. This method does not depend on any other properties of the object and can be performed without knowledge of anything outside of the method.Math
objectpublic int MyFavoriteNumber
. The value of that property does not matter. It is not needed for the Add methodStart()
method might perform differently for that instance of Car versus a 2022 Tesla Model 3public static class StatelessAdder
{
public static int Add(int a, int b)
{
return a + b;
}
}
public class StatefulAdder
{
private int _value;
public int Add(int a)
{
_value += a;
return _value;
}
}