Hi,

On Wed, Feb 15, 2012 at 7:47 AM, srcKode <[email protected]> wrote:
> foreach (EmbeddedResource eres in
> Source.Module.Resources.OfType<EmbeddedResource>())
>  Target.Module.Resources.Add(eres);

As a general advice, it's better to clone objects instead of moving
Cecil objects from one module to another. You should use:

foreach (var resource in
Source.Module.Resources.OfType<EmbeddedResource>().Select(r => new
EmbeddedResource(r.Name, r.Attributes, r.Data));

> in both the cases the resources get added but I am not able to add the
> resource to the existing name.g.resources.

I'm afraid I don't know what a name.g.resources is, or what gets into
it. It's specific to SL, so there's nothing in Cecil to manipulate it
for you.

Based on the name, I assume it's some kind of resource, so you can
definitely read it with Cecil, and modify or recreate a resource in
your target module.

Jb

-- 
--
mono-cecil

Reply via email to