You should be able to code a settings reading class in no time flat. Heck, you could code generate it and go home early. That way it can be as robust and error handled as you like, and it'll be shedloads faster than 700ms.
I agree. If you're at all concerned with execution speed, using reflection seems like a poor path to take. – overslacked Dec 1 '09 at 4:56 reflection is not such a big hit in my case, its taking me 63 ms to load the dom (forward parsing is a much faster route... but probably not worth the effort) and 17 ms to load my fields with reflection and I am not done optimising.
– Sam Saffron? Dec 1 '09 at 12:37.
Sorry really do not mean to sound rude, but sgen is completely out of the question. – Sam Saffron? Dec 1 '09 at 4:32.
If you use sgen. Exe with the /keep option, it will keep the generated C# source that you can then integrate into your project. You can customize it as you see fit.
EDIT: In other words, you're using sgen not as a pre-compiler (which you say you can't do), but as a code-generator.
I wrote my own... feel free to use it if anyone has similar specs the code it under the BSD license. Here are some sample tests, it generates lovely XML just like the XML serializer only much faster for config file scenarios where sgen is not an option: using System; using System.Collections. Generic; using System.
Linq; using System. Text; using System. IO; using NUnit.
Framework; using MediaBrowser.Library. Persistance; namespace TestMediaBrowser. Unit { TestFixture public class TestXmlSettings { enum Farts { Smelly, SilentButDeadly } class Monster { public Weapon Weapon; } class Weapon { public int LaserCount { get; set; } } class Farter { public Farts Smell = Farts.
Smelly; } class Group { public List People; } class Person { public int Age = 1; public string Name = "Default"; public bool Happy = true; public DateTime Birthdate = DateTime. Now; } class Account { public Person Person; public int Balance; } const string CONFIG_FILE = "test. Config"; private void ClearConfig() { if (File.
Exists(CONFIG_FILE)) { File. Delete(CONFIG_FILE); } } public void TestProperty() { ClearConfig(); Monster monster = new Monster(); XmlSettings settings = XmlSettings. Bind(monster, CONFIG_FILE); monster.
Weapon = new Weapon(); monster.Weapon. LaserCount = 99; settings.Write(); monster = new Monster(); settings = XmlSettings. Bind(monster, CONFIG_FILE); Assert.
AreEqual(monster.Weapon. LaserCount, 99); } public void TestEnum() { ClearConfig(); Farter farter = new Farter(); XmlSettings settings = XmlSettings. Bind(farter, CONFIG_FILE); farter.
Smell = Farts. SilentButDeadly; settings.Write(); farter = new Farter(); settings = XmlSettings. Bind(farter, CONFIG_FILE); Assert.
AreEqual(farter. Smell, Farts. SilentButDeadly); } Test public void TestList() { ClearConfig(); Group group = new Group(); group.
People = new List(); group.People. Add(new Person()); group.People. Add(new Person()); XmlSettings settings = XmlSettings.
Bind(group, CONFIG_FILE); settings.Write(); group = new Group(); settings = XmlSettings. Bind(group, CONFIG_FILE); Assert. AreEqual(group.People.
Count, 2); } Test public void BasicValueTypeTest() { ClearConfig(); var person = new Person(); XmlSettings settings = XmlSettings. Bind(person, CONFIG_FILE); person. Age = 3; person.Name = "Sam"; person.
Happy = false; person. Birthdate = DateTime. Today; settings.Write(); person = new Person(); settings = XmlSettings.
Bind(person, CONFIG_FILE); Assert. AreEqual(person. Age, 3); Assert.
AreEqual(person. Name, "Sam"); Assert. AreEqual(person.
Happy, false); Assert. AreEqual(person. Birthdate, DateTime.
Today); } Test public void NestedObjectTypeTest() { ClearConfig(); var account = new Account(); var settings = XmlSettings. Bind(account, CONFIG_FILE); var person = new Person(); person. Age = 3; person.
Name = "Sam"; person. Happy = false; person. Birthdate = DateTime.
Today; account. Person = person; account. Balance = 999; settings.Write(); account = new Account(); settings = XmlSettings.
Bind(account, CONFIG_FILE); person = account. Person; Assert. AreEqual(account.
Balance, 999); Assert. AreEqual(person. Age, 3); Assert.
AreEqual(person. Name, "Sam"); Assert. AreEqual(person.
Happy, false); Assert. AreEqual(person. Birthdate, DateTime.
Today); } } }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.