Saving a contact and dealing with exceptions try{save.Username = usernamedetails.Rows[0].ItemArray[0].ToString(); }
catch{ save.Username = ""; }
try { save.Firstname = dtdetails.Rows[0].ItemArray[1].ToString(); }
catch { save.Firstname = ""; }
try { save.LastName = dtdetails.Rows[0].ItemArray[2].ToString(); }
catch { save.LastName = ""; }
try { save.Address1 = dtdetails.Rows[0].ItemArray[3].ToString(); }
catch { save.Address1 = ""; }
try { save.Address2 = dtdetails.Rows[0].ItemArray[4].ToString(); }
catch { save.Address2 = ""; }
try { save.Postoffice = dtdetails.Rows[0].ItemArray[5].ToString(); }
catch { save.Postoffice = ""; }
try { save.District = dtdetails.Rows[0].ItemArray[6].ToString(); }
catch { save.District = ""; }
try{ save.State = dtdetails.Rows[0].ItemArray[7].ToString(); }
catch{ save.State = ""; }
try { save.Country = dtdetails.Rows[0].ItemArray[8].ToString(); }
catch { save.Country = ""; }
try { save.MobileNumber = dtdetails.Rows[0].ItemArray[9].ToString(); }
catch { save.MobileNumber = ""; }
try { save.LandLine = dtdetails.Rows[0].ItemArray[10].ToString(); }
catch { save.LandLine = ""; }
try { save.Pin = dtdetails.Rows[0].ItemArray[11].ToString(); }
catch { save.Pin = ""; }
try { save.Cmpnyname = dtdetails.Rows[0].ItemArray[12].ToString(); }
catch { save.Cmpnyname = ""; }
try { save.Design = dtdetails.Rows[0].ItemArray[13].ToString(); }
catch { save.Design = ""; }
try { save.Loc = dtdetails.Rows[0].ItemArray[14].ToString(); }
catch { save.Loc = ""; }
try { save.CmpnyPincode = dtdetails.Rows[0].ItemArray[15].ToString(); }
catch { save.CmpnyPincode = ""; }
try { save.EmailID = dtdetails.Rows[0].ItemArray[16].ToString(); }
catch { save.EmailID = ""; }
try { save.OffNumber = dtdetails.Rows[0].ItemArray[17].ToString(); }
catch { save.OffNumber = ""; }


Is this type of strategy suitable for coding?
You shouldn't use general catch, you should always catch only the exceptions that you actually want to catch.
Avoidable exceptions like index out of range or null reference should indicate an error in your code. Instead of handling them, you should make sure they never happen.


For your specific case, you could write an extension method that checks that the index isn't out of range and that the value isn't null (and returns empty string if it is).

Something like:

public static string GetAsStringOrEmpty(this object[] array, int index)
{
    if (array == null)
        throw new ArgumentNullException("array");

    if (index &gt;= 0 &amp;&amp; index &lt; array.Length)
    {
        string value = array[index] as string;

        if (value != null)
            return value;
    }

    return string.Empty;
}


You would then use it like this:

var array = dtdetails.Rows[0].ItemArray;
save.Firstname = array.GetAsStringOrEmpty(1);
save.LastName = array.GetAsStringOrEmpty(2);
…