covertx

I have written the following code, and submitted for build:

Return Convert.ToBase64String(encryptedBytes)

I've used this line in different applications with no problem, but when trying to use it for my latest application, I get the following error:

"Overload resolution failed because no accessible 'Convert' accepts this number of arguments."

Does anyone know why I could be getting this error

Many thanks



Re: Visual C# General Convert method

Thomas Danecker

Are you sure you're using the correct Convert class Maybe you've another Convert class with a ToBase64String method which has other arguments. It's just a wild guess.

Or are you building against the .net Compact Framework < 2.0 The specified method was not contained in it until v2.0.

Maybe the error is caused by another line of code

Just some ideas. I can't tell you more to the line you've posted.

A trivial guess: Maybe encrypedBytes is no byte array




Re: Visual C# General Convert method

covertx

I did wonder if I was using the right convert method, but after having successfully used it in an application SECONDS before using it again in this scenario, I figured that I probably am using the right method!

Which leaves me even more confused Stick out tongue





Re: Visual C# General Convert method

Thomas Danecker

Could you post the full method wher you're getting the error Maybe someting else causes it.

You may also try to fully qualify the class: return System.Convert.ToBase64String(encryptedBytes);






Re: Visual C# General Convert method

covertx

It was such a stupid error that I didn't even think of such a stupidly basic solution! LOL

Thanks Thomas!





Re: Visual C# General Convert method

Thomas Danecker

What was your mistake






Re: Visual C# General Convert method

covertx

Convert, instead of System.Convert!





Re: Visual C# General Convert method

Thomas Danecker

If you have a "using System;" on the top of your C# file, the "System." is not required. It's looking like you've another Convert class anywhere in another namespace.