TwitCore/Helpers/Base64Handler.cs
/// <summary>
/// Decodes a base 64 string, as per the encoding type indicated. If it can't be decoded (due to incorrect format) it will return a null value and a false
/// </summary>
/// <param name="encoding">Encoding, like UTF-8</param>
/// <param name="encodedText">Text to be decoded</param>
/// <param name="decodedText">The decoded text</param>
/// <returns></returns>
Decodes a base 64 string, as per the encoding type indicated. If it can't be decoded (due to incorrect format) it will return a null value and a false
Decodes a base 64 string as per the encoding type indicated . If it can ' t be decoded ( due to incorrect format ) it will return a null value and a false
public static bool TryDecodeBase64(this System.Text.Encoding encoding, string encodedText, out string decodedText) {
            if (encodedText == null) {
                decodedText = null;
                return false;
            }
            try {
                byte[] textAsBytes = Convert.FromBase64String(encodedText);
                decodedText = encoding.GetString(textAsBytes);
                return true;
            }
            catch (Exception) {
                decodedText = null;
                return false;
            }
        }
public static bool TryDecodeBase64 ( this System . Text . Encoding encoding , string encodedText , out string decodedText ) { if ( encodedText == null ) { decodedText = null ; return false ; } try { byte [ ] textAsBytes = Convert . FromBase64String ( encodedText ) ; decodedText = encoding . GetString ( textAsBytes ) ; return true ; } catch ( Exception ) { decodedText = null ; return false ; } }
Decodes a base 64 string, as per the encoding type indicated.
Decodes a base 64 string as per the encoding type indicated .
None
System.Text.Encoding
this
encodedText
string
Text to be decoded
Text to be decoded
string
out
encoding
Encoding, like UTF-8
Encoding like UTF - 8
decodedText
The decoded text
The decoded text