Methods without any return value in C#
Forums:
class Counter {
public int Count { get; set; }
public void incBy(int value) {
Count += value;
}
public void incBy(int value, int amount) {
Count += value * amount;
}
}
var counter = new Counter();
counter.incBy(1);
//counter.Count is 1
counter.incBy(2, 5);
//counter.Count is 11
- Log in to post comments