Hi Ian, I think it would be preferable to have a common resource assembly (e.g. NAnt.Resources.dll).
Letting an assembly access resources of another assembly and viceversa is not that elegant. Moreover, it would be difficult to maintain messages consistently. There are also performance issues; actually, the code for getting a localized string is as following: public static string GetString(string name, CultureInfo culture) { if (resourceManager == null) { lock (typeof(ResourceUtils)) { if (resourceManager == null) { Assembly assembly = Assembly.GetCallingAssembly(); resourceManager = new ResourceManager( assembly.GetName().Name, assembly); } } } return resourceManager.GetString(name, culture); } In the code above, the lock takes place only once (the first time a string is retrieved), assuring good performance. Adding the functionality to register additional assemblies, the lock would take place always as demonstrated in the following code chunk: static ResourceUtils() { resourceManagerDictionary = new ResourceManagerDictionary(); } public static void RegisterAssembly(Assembly assembly) { lock (resourceManagerDictionary) { resourceManagerDictionary.Add(assembly.GetName().Name, new ResourceManager(assembly.GetName().Name, assembly)) } } public static string GetString(string name, CultureInfo culture) { string localizedString = null; ResourceManager resourceManager = null; lock (resourceManagerDictionary) { foreach (DictionaryEntry entry in resourceManagerDictionary) { resourceManager = entry.Value as ResourceManager; localizedString = resourceManager.GetString(name, culture); if (localizedString != null) { break; } } } return localizedString; } The methods RegisterAssembly() and GetString() must be kept synchronized... What do you think about? Giuseppe Greco Software Architect Banca del Gottardo via Trevano 2A 6901 Lugano Swizterland Phone: +41 91 808 16 79 Fax: +41 91 808 24 00 Web: www.gottardo.com ---------------------------------- DISCLAIMER ---------------------------------- This message (including any attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system.Any unauthorised use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. Banca del Gottardo (including its group companies) shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system. Under no circumstances this message can be considered as a written acceptance or confirmation of an instruction/order given to Banca del Gottardo. Instructions and orders cannot be accepted or confirmed via e-mail. Banca del Gottardo (or its group companies) does not guarantee that the integrity of this communication has been maintained nor that this communication is free of viruses, interceptions or interference. --------------------------------------------------------------------------------- ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers