public static void Main()
const string xml = @"<Message xmlns=""http://www.example.com/schema/msc/message"">
<Events xmlns=""http://www.example.com/schema/msc/referral"" Code=""AC"">
<ref:User xmlns:ref=""http://www.example.com/schema/msc/referral"" Name=""asdf""/>
XNamespace message = "http://www.example.com/schema/msc/message";
XNamespace referral = "http://www.example.com/schema/msc/referral";
var root = XElement.Parse(xml);
RoutingCode = (string) root.Elements(message + "Params")
.Elements(referral + "Events")
AccountName = (string) root.Elements(message + "Params")
.Elements(referral + "Events")
.Elements(referral + "User")
Console.WriteLine(dto.RoutingCode);
Console.WriteLine(dto.User.AccountName);