I got next code:
private Dictionary<int?, byte[]> GetAllLocalScanFiles()
{
using (DZine_IStylingEntities ctxLocal = new DZine_IStylingEntities())
{
_scanDictionaryLocal = ctxLocal.tblScan
.Select(s => new { s.MEMBERID, s.scanFileAvatar })
.AsParallel()
.ToDictionary(s => s.MEMBERID, s => s.scanFileAvatar);
}
return _scanDictionaryLocal;
}
I want to change the Ditionary in Dictionary<int?, ScanClass>
ScanClass is an Object
public class ScanClass
{
public byte[] ScanFileAvatar { get; set; }
public byte[] Hair { get; set; }
}
Is it possible to give an object for the value of a Dictionary?
PS I don’t want to do this with a lookup.
Thanks in advance!
Sounds like you probably want something like:
That’s assuming you have a
hairproperty in your original entity.It’s not clear that
AsParallelis really going to help you here though. You might want to consider usingAsEnumerable()instead, unless you have a reason to parallelize this.