Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to encode and decode a string in c#

public static string encode(string text)
{
    byte[] mybyte = System.Text.Encoding.UTF8.GetBytes(text);
    string returntext = System.Convert.ToBase64String(mybyte);
    return returntext;
}

public static string decode(string text)
{
    byte[] mybyte = System.Convert.FromBase64String(text);
    string returntext = System.Text.Encoding.UTF8.GetString(mybyte);
    return returntext;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: remove first character in a string c# 
Csharp :: C# convert iformfile to stream 
Csharp :: How to search for a string from readline in c# 
Csharp :: c# dictionary first 
Csharp :: get text component unity 
Csharp :: C# Console multi language 
Csharp :: c# start file 
Csharp :: get name of project c# .net 
Csharp :: c# inline a function 
Csharp :: c# how to terminate console application 
Csharp :: get connectionstring from web config c# 
Csharp :: fill all array c# with same value 
Csharp :: unity how get random color to material 
Csharp :: make invisible unity 
Csharp :: how to add item to listbox in c# 
Csharp :: Attribute [livewire] does not exist. 
Csharp :: write text files with C# 
Csharp :: C# .net core convert string to enum 
Csharp :: slider.onchanged in unity 
Csharp :: c# cast to type variable 
Csharp :: c# create array 
Csharp :: unity topdown movement 
Csharp :: c# add picturebox to form 
Csharp :: c# file directory selection 
Csharp :: c# list subfolders 
Csharp :: unity log warning 
Csharp :: blazor swagger setup 
Csharp :: system.windows.forms not found 
Csharp :: The server requested authentication method unknown to the client 
Csharp :: mapping dictionary to object c# 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =