I want to migrate my farm solution from SharePoint 2010 to SharePoint 2019. I have RunWithElevatedPrivileges method used in SP2010 solution. Can it be used in SP2019 also?
Looks like yes.
According to the MS documentation page for
SPSecurity.RunWithElevatedPrivileges, it applies to the "Latest" version of SharePoint Server.