Mirror changes from dotnet/corefx (#15909)
* Consolidate System.Memory code to shared folder (dotnet/corefx#26393)
* Consolidate System.Memory code to shared folder
This change is removing the duplicate codes from System.Memory and keep only one copy under the shared folder to be easier to edit such code in one place and get reflected on the other repos.
* Address the review feedback
* Addressing more feedback
* More cleanup
* remove empty line and added a comment
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
* Add missing throw helper methods used in the code we got from corefx
* Update the exception helper
* fix the break