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
VulpesPosted Sep 19, 2012, 5:00 AM
Shivanand ArurPosted Sep 19, 2012, 9:14 AM
VulpesPosted Sep 19, 2012, 8:13 AM
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 ArurPosted Sep 19, 2012, 7:58 AM
What say???
Posted Sep 19, 2012, 6:40 AM