C# how to get text value from PasswordBox?

前端 未结 4 786
無奈伤痛
無奈伤痛 2021-02-11 11:49

I have a PasswordBox. how can I get the input value from the PasswordBox after the input has been finished?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-11 12:44

    You may not want to store the password in clear text in memory, from the msdn doc you should use SecurePassword in order to prevent that.

    Example: SecureString myPass = passwordBox.SecurePassword

    https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.passwordbox.securepassword

提交回复
热议问题