It does not make sense. using the properties as you currently have them, you can simply write:
Travel t = new Travel(); string tvlName = t.TravelName; string desc = t.TravelDescription;
If you changed the way you want, you will also need to specify a parameter
Travel t = new Travel(); LocalizedString tvlName = t.TravelName([someresopurcedesignator]); LocalizedString desc = t.TravelDescription([someresopurcedesignator]);
all you could do was create a propertyBag emulator
public class Travel { private LocalizedString props = new LocalizedString(); public LocalizedString Propertys { get { return props; } set { props = value; } } } public class LocalizedString // this is property Bag emulator { public string this[string resourceName] { get{ return LocaleHelper.GetRessource(resourceName); } set{ LocaleHelper.GetRessource(resourceName) = value; } } }
You would access this as follows:
Travel t = new Travel(); t.Propertys[NameResource1] = "Bob Smith"; t.Propertys[DescriptionResource2] = "Fun trip to discover the orient"; string tvlName = t.Propertys[NameResource1]; string desc = t.Propertys[DescriptionResource2];
source share