C#: My experience with const keyword
Nov30

C#: My experience with const keyword

Welcome to CodeSpread! There are numerous post on internet about ‘what is const keyword in .net’ or ‘what is the difference between const keyword and read only’ and I must say many might have already mugged it up like me I can bet, many of us might not have tried some exercise to learn the real implementation or did not get caught in a situation where the learning would have come on the doorsteps by itself. I...

Read More

Useful ‘ref’ and ‘out’ parameters

It took me some time to realize the real potential of ref and out keywords, till the time I experience a condition which could only be simplified by implementing ref and out keyword. Lets start by a simple code example and will evolve while moving forward. public int CalculateSavings(int principal) { int result=0; //Calculate savings and return result return result; } Here we have a method ‘CalculateSavings’ which takes a...

Read More