We don't recommend that you use thehttps://docs.microsoft.com/en-us/dotnet/api/system.security.securestring
SecureStringclass for new development. For more information, see SecureString shouldn't be used on GitHub.
Don't use SecureString for new code. When porting code to .NET Core, consider that the contents of the array are not encrypted in memory.DE0001 SecureString shouldn't be used
The general approach of dealing with credentials is to avoid them and instead rely on other means to authenticate, such as certificates or Windows authentication.