XmlSerializer serializer = new XmlSerializer(typeof(OrderedItem));
OrderedItem i = new OrderedItem();
i.ItemName = "Widget";
i.Description = "Regular Widget";
i.Quantity = 10;
i.UnitPrice = (decimal) 2.30;
// Create an XmlSerializerNamespaces object.
XmlSerializerNamespaces ns =
// Add two namespaces with prefixes.
// Create an XmlTextWriter using a FileStream.
Stream fs = new FileStream(filename, FileMode.Create);
XmlWriter writer =
new XmlTextWriter(fs, new UTF8Encoding());
// Serialize using the XmlTextWriter.
serializer.Serialize(writer, i, ns);
XNamespace root = "http://website.RFGCommonSpecListingSchema";
XNamespace xs = "http://www.w3.org/2001/XMLSchema";
XNamespace b = "http://schemas.microsoft.com/BizTalk/2003";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", null),
new XElement(xs + "schema",
new XAttribute("xmlns", root.NamespaceName),
new XAttribute(XNamespace.Xmlns + "b", b.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xs", xs.NamespaceName),
new XAttribute("targetNamespace", "http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema"),
new XAttribute("elementFormDefault", "qualified"),
new XAttribute("attributeFormDefault", "unqualified"),
// TODO: Document content goes here...
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I've been looking at a problem for the last couple of days, that hopefully someone has an answer for. When I get my variable (cr) as shown below, I can't use the variable and then step into the next method call and code that once worked is now not working. When I look into the class definition inside cr, it says "could not evaluate expression" edfed for the variable inside the class (cr).
This looks to be the likeliest culprit. The question I'd have here is what is the value of type? In your switch statement, it only retrieves this value if it's CRType.CR5. If it's not that type, then it doesn't look like you're returning anything.
I was brought up to respect my elders. I don't respect many people nowadays.