Which is better and faster LINQ Query or Formula?

Hobbyist_programmer 621 Reputation points
2021-03-11T11:21:35.203+00:00

Hallo,

I just want to know the expert opinion on something I am planning to do. I have to write a method to determine cost of multiple objects . I can do this in two ways

  1. Make a table with list of items and costs ( so basically I get cost data from a table - aprox 2000 rows & 3 columns) then use LINQ to list of objects
  2. Create a polynomial function to calculate cost of an item ( at lease 10-20 lines of code depend on item)

what is better and faster?

Thanks

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,569 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Karen Payne MVP 35,036 Reputation points
    2021-03-11T12:26:11.183+00:00

    If values used in option two never change use this version while if values will change over time use option one.

    0 comments No comments

  2. Hobbyist_programmer 621 Reputation points
    2021-03-11T12:38:07.627+00:00

    is there any performance difference between these two?