Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
decode test
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Web; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Reflection; namespace Rextester { public class Program { public static void Main(string[] args) { testing myTest = new testing(); myTest.TestAbc = "& & &"; myTest.TestDef = "& &"; myTest = (testing)ObjectHtmlDecode(myTest); Console.WriteLine(myTest.TestAbc); Console.WriteLine(myTest.TestDef); } public static object ObjectHtmlDecode(object myObj) { foreach (PropertyInfo prop in myObj.GetType().GetProperties()) { var type = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType; if (type == typeof(string)) { if (prop.GetValue(myObj) != null) { prop.SetValue(myObj, HttpUtility.HtmlDecode(prop.GetValue(myObj).ToString())); } } } //return inputted myObj with decoded properties. boxing and unboxing done outside of this method to cast the object back to it's class return myObj; } } public class testing { private string testabc; private string testdef; public string TestAbc { get { return testabc; } set { testabc = value; } } public string TestDef { get { return testdef; } set { testdef = value; } } } }
run
|
edit
|
history
|
help
0
Main 5.5
pattern
Calculate Used Unit from Readings
countvowels
ProtectedUse
SpiltStringBetweenSpecialCharacters
recur 4
ProbableCause
Testing 10
FizzBuzz C#