This incomplete program is given in the following website http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory01122006130034PM/csharp_memory.aspx. Whether it is possible to complete the program.
public class MyInt
{
public int MyValue;
and the following method is executing:
public MyInt AddFive(int pValue)
{
MyInt result = new MyInt();
result.MyValue = pValue + 5;
return result;
}
}
Loading

VulpesRank #55 · 29.2K reputationPosted Sep 19, 2012, 1:00 AM EDT
Posted Sep 19, 2012, 2:40 AM EDT
Shivanand ArurRank #920 · 2.3K reputationPosted Sep 19, 2012, 3:58 AM EDT
What say???
VulpesRank #55 · 29.2K reputationPosted Sep 19, 2012, 4:13 AM EDT
When I write console applications myself, I always use int.TryParse rather than either int.Parse or Convert.ToInt32. I can then trap any invalid response and deal with it appropriately.
However, I haven't used it here as I didn't want to 'bog down' Maha with details of how it works, when the question is really being asked in relation to the difference between stack and heap allocation.
Shivanand ArurRank #920 · 2.3K reputationPosted Sep 19, 2012, 5:14 AM EDT