07-24-2023, 05:34 AM
I'm converting something from VB into C#. Having a problem with the syntax of this statement:
if ((searchResult.Properties["user"].Count > 0))
{
profile.User = System.Text.Encoding.UTF8.GetString(searchResult.Properties["user"][0]);
}
I then see the following errors:
> Argument 1: cannot convert from 'object' to 'byte[]'
>
> The best overloaded method match for
> 'System.Text.Encoding.GetString(byte[])' has some invalid arguments
I tried to fix the code based on [this][1] post, but still no success:
string User = Encoding.UTF8.GetString("user", 0);
Any suggestions?
[1]:
if ((searchResult.Properties["user"].Count > 0))
{
profile.User = System.Text.Encoding.UTF8.GetString(searchResult.Properties["user"][0]);
}
I then see the following errors:
> Argument 1: cannot convert from 'object' to 'byte[]'
>
> The best overloaded method match for
> 'System.Text.Encoding.GetString(byte[])' has some invalid arguments
I tried to fix the code based on [this][1] post, but still no success:
string User = Encoding.UTF8.GetString("user", 0);
Any suggestions?
[1]:
[To see links please register here]