0

Hi!

I'm working with an XSD Schema in C# and I have all of the classes imported through a C# code generator. Now I want to know if an element/property of a class is mandatory, optional and such. Any clues anyone?

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by DdoubleD
0
using System;
using System.Collections.Generic;
using System.Text;
 
namespace XSDTest
{
    class Program
    {
        static void Main(string[] args)
        {
            System.IO.StreamReader str = new System.IO.StreamReader("webSearch.xml");
            System.Xml.Serialization.XmlSerializer xSerializer = new System.Xml.Serialization.XmlSerializer(typeof(ResultSet));
            ResultSet res = (ResultSet) xSerializer.Deserialize(str);
            foreach (ResultSetResult r in res.Result)
            {
                Console.WriteLine(r.Title);
                Console.WriteLine(r.Summary);
                Console.WriteLine();
            }
            str.Close();
 
            Console.ReadLine();
        }
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.