ContentManager can't be passed? Is there a workaround?

I know a while back I was passing ‘Content’ to my custom classes just fine, even setting a private ContentManager object to the passed one. Now, if I attempt

ImagePool image_pool = new ImagePool(Content); // The error is here

class ImagePool
{
    ContentManager content;
    List<ImageSet> image_sets = new List<ImageSet>();

    public ImagePool(ContentManager content_)
    {
        content = content_;
    }

I get

A field initializer cannot reference the non-static field, method, or property 'Game.Content'

I don’t really want to ruin my neat code with globals. My ImagePool class is meant to share and manage resources, so one sprite isn’t using a separate copy of the same Texture2D in memory as another. The outside program just passes a string to the image pool, and the ImagePool (should) load it itself.

I believe this is a generic C# error caused by the fact that (I assume) you’re trying to construct the new ImagePool using Content in a field initializer, which will execute before the Content field actually references an object. Take a look at this example:

class Game
{
  ImagePool image_pool_1 = new ImagePool(Content); // compiler doesn't like this
  ImagePool image_pool_2;

  public Game()
  {
    image_pool_2 = new ImagePool(Content); // this should be fine
  }
}

That did it, whoops. Thank you.