Passing SharePoint objects as arguments to a function. This is bad?
I am creating a web part that includes a function with an SPList as one argument. The skipped list will grow over time, which makes me worry about the scalability issue. Should I be worried about potential performance issues using this method?
If you can offer any insight into other SharePoint objects (SPSite, etc.) related to my question, or provide a link to further reading on this topic, I'd really appreciate it!
a source to share
Why would this be a problem? Do you expect the data in the list to be copied when you call the function? It will not happen. SPList is a reference to an SPList object and you only copy the reference.
Otherwise, I can't figure out why the scalability issue occurs. Please indicate why you think there may be one.
a source to share
To add to John Saunders answer, objects like SPList don't actually create a list of all this data in memory when instantiated. Rather, it creates a connection to where the list data is stored in the database, and any calls to that object run its own SQL on the backend. Essentially, the SPList object is a link. Passing it as a parameter is ok!
a source to share