Will using LINQ increase the size/memory usage of my c# assembly? RRS feed

  • Question

  • Hi,

    I know LINQ makes things easier - but does it come at the cost of
    1. Size of assembly?
    2. More RAM usage at the time of execution?
    3. Any other negative on size or performance?

    Thanks so much.

    • Edited by frob Saturday, November 2, 2013 4:10 AM
    Saturday, November 2, 2013 4:10 AM


  • LINQ is just a set of extension methods. When you build your project, all LINQ expressions will be replaced with just method calls.

    1. Size of the assembly : What is you do not use LINQ? You will need to write all the logic by yourself. For example, if you want select some item based on certain criteria, you need to loop through all elements in the collection, add an if condition to see whether item meets selection criteria etc etc.. Now with LINQ, you will replace all this code by just one method call. So, I will say LINQ in fact reduces your assembly size (not drastically though).

    2. RAM usage: LINQ methods use highly optimized algorithms. So, do not worry about RAM usage.

    I hope this helps.

    Please mark this post as answer if it solved your problem. Happy Programming!

    • Marked as answer by frob Monday, November 11, 2013 10:26 PM
    Saturday, November 2, 2013 4:47 AM