Hi,

I have been programming in Java for a few years and have just started learning C#.
I have created the following code:
Code:
public static void WriteToFile(Song song, String filename)
        {
            Console.WriteLine("About to write to file");
            try
            {
                XmlSerializer writer = new XmlSerializer(typeof(Song));
                StreamWriter file = new StreamWriter(filename);
                writer.Serialize(file, song);
                file.Close();
                Console.WriteLine("Wrote to file successfully");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
But the resulting file only contains:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Song xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
What am I doing wrong?

Thanks