How I can get '*' characters instead of any string in InArgument<string>

232 Views Asked by At

I have a property 'Text' that stores any text, or a password. When the property contains a password, I need to display the characters '*' instead of the password. I have a view in which there is an ExpressionTextbox associated with this property. Everything is well displayed, but on execution I get an error: The argument of type 'System.String' cannot be used. Make sure that it is declared on an activity

Here is the code:

private InArgument<string> _text; 

public InArgument<string> Text
{
    get
    {
        if (Model.HideValue)
        {
            return new string('*', Model.Text.Length);
        }

        return _text;
    }
    set => _text = value;
}

....

protected override void Execute(NativeActivityContext context)
{
    Model.PopulateText = PopulateText.Get(context); // here I get an error

    base.Execute(context);
}

So, how I can get '*' symbols instead text when is value type is password?

1

There are 1 best solutions below

0
Vivian Mascarenhas On

Use SecureString Class for the Password Field. Instead of masking the field