I have got below XMLEncode function in VBScript function. I want to write similar function in C# 2.0
Function XMLEncode(byVal stringtoencode)
Dim strTemp ' As String
strTemp = stringtoencode
strTemp = Replace( strTemp, chr(38), "&" )
strTemp = Replace( strTemp, chr(34), """ )
strTemp = Replace( strTemp, chr(60), "<" )
strTemp = Replace( strTemp, chr(62), ">" )
strTemp = Replace( strTemp, chr(169), "©" )
XMLEncode = strTemp
End Function
Please suggest!! if there is any in built function in c# or do I need to write same logic in C#