[Mono-list] ResourceManager

Kornél Pál kornelpal at hotmail.com
Wed Nov 16 12:54:03 EST 2005


Hi,

> This code should work fine with .Net/Windows.

This should not work on either Microsoft .NET Framework or on Mono.
ResourceManager has only one constructor that takes 1 parameter that is type
of System.Type in this case. System.Reflection.Assembly is not derived from
System.Type so cannot be casted to System.Type. That's why you have to get a
compiler error.

> What shoud I use as System.Type in ResourceManager ?

If you use a Type it's asseembly and name will be used to locate the
resource so it depends on the name of the class and the name of the
resource.

I suggest however to use the constructor that takes a string (resource name)
and an assembly (that contains the resource).

Kornél

----- Original Message -----
From: "Julien Sobrier" <julien at sobrier.net>
To: <mono-list at lists.ximian.com>
Sent: Wednesday, November 16, 2005 6:31 PM
Subject: [Mono-list] ResourceManager


> Hello,
>
> I have a problem with this code:
>
> using System;
> using System.Collections;
> using System.Resources;
> using System.Reflection;
>
> public void resource()
> {
>    ResourceManager rm = new
> ResourceManager(Assembly.GetExecutingAssembly());
>
>     string name = rm.GetString("MediaInfoDB.sql");
> }
>
>
> "The best overloaded method match for
> System.ResourceManager.ResourceManager(System.Type) has some invalid
> arguments
> Cannot convert from System.Reflection.Assembly to System.Type"
>
> This code should work fine with .Net/Windows.
>
> I'm using Mono 1.1.10?
>
>
> What shoud I use as System.Type in ResourceManager ?
>
> Thank you
> Julien
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>



More information about the Mono-list mailing list