using System.Collections.Generic; namespace Kit.Helpers.Extension.Entities { public interface IInt32Id { int Id { get; } } public static class IInt32IdExtentions { public static IDictionary ConvertToDictionary(this IEnumerable objects) where TObject : IInt32Id { var dictionary = new Dictionary(); { foreach (var obj in objects) dictionary.Add(obj.Id, obj); } return dictionary; } } }