Skip to content

Bind/Rebind to a constant generic List always returns an empty list #333

@pcroc

Description

@pcroc
StandardKernel kernel = new StandardKernel();

List<int> list = new List<int> { 1, 2, 3, 4, 5 };
kernel.Bind<List<int>>().ToConstant(list).InSingletonScope();

var result = kernel.Get<List<int>>();

Console.WriteLine("{0}", list.Count); // 5
Console.WriteLine("{0}", result.Count); // 0, expected 5
Console.WriteLine("{0}", result == list); // False, expected True

Ninject version 3.3.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions