Horje
use & symbole in xml as a text using c# Code Example
use & symbole in xml as a text using c#
public static string EscapeXml( this string s )
{
  string toxml = s;
  if ( !string.IsNullOrEmpty( toxml ) )
  {
    // replace literal values with entities
    toxml = toxml.Replace( "&", "&" );
    toxml = toxml.Replace( "'", "'" );
    toxml = toxml.Replace( "\"", """ );
    toxml = toxml.Replace( ">", ">" );
    toxml = toxml.Replace( "<", "<" );
  }
  return toxml;
}

public static string UnescapeXml( this string s )
{
  string unxml = s;
  if ( !string.IsNullOrEmpty( unxml ) )
  {
    // replace entities with literal values
    unxml = unxml.Replace( "'", "'" );
    unxml = unxml.Replace( """, "\"" );
    unxml = unxml.Replace( ">", ">" );
    unxml = unxml.Replace( "<", "<" );
    unxml = unxml.Replace( "&", "&" );
  }
  return unxml;
}




Csharp

Related
Store Images In SQL Server Using EF Core And ASP.NET Core Code Example Store Images In SQL Server Using EF Core And ASP.NET Core Code Example
convert iqueryable to list c# Code Example convert iqueryable to list c# Code Example
justin bieber Code Example justin bieber Code Example
how to write int array to console c# Code Example how to write int array to console c# Code Example
C# encrypt folder SHA512 Code Example C# encrypt folder SHA512 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12