Avoid Multiple method call or alternate way for performance RRS feed

  • Question

  • User-1401876114 posted

    Hello All,

    There is a single method  which is being called about close to 5 times in each line back to back. I need to re-write it for performance. 

    Written in simplified way.

    public String GetAlternateAdress(int SSN, enum typeCode)
    case 1: address = "A";
    return address;
    Calling method
    void main()
    string Alt1 = GetAlternateAdress(123,enum.value);//1
    string Alt2 = GetAlternateAdress(123,enum.value);//2
    string Alt3 = GetAlternateAdress(123,enum.value);//3
    string Alt4 = GetAlternateAdress(123,enum.value);//4
    //further code

    Tuesday, August 28, 2018 6:46 AM

All replies

  • User753101303 posted


    Seeing the slowpart could help. If it deals just with memory variables it shouldn't be that slow (or you have db access code at some point ? .It seems it could be exposed as an array a basically you get a value based on numeric index ???

    Tuesday, August 28, 2018 7:05 AM
  • User-1401876114 posted

    This method is being called in different Components. Yes it makes a DB call and thats why i wanted to change it. 

    Tuesday, August 28, 2018 7:19 AM
  • User283571144 posted

    Hi shreenidhi,

    According to your description, I suggest you could consider converting the method to async method.

    Then it could be more faster.

    Moer details about how to use async and the effect in asp.net, you could refer to below article.


    Best Regards,


    Friday, August 31, 2018 9:49 AM