I have a Lazy<List<T>>
where T is a class which has a huge string and metadata about files.
Let's call them Property HugeString
and Property Metadata
I have this class U, which has the same property HugeString
, among other things. I have to convert Lazy<List<T>>
to Lazy<List<U>>
without loading all stuff.
Is it possible ?
This is where I create my list, and inside that method I get info about the file and the file itself:
entity.VersionedItems =
new Lazy<List<VersionedItemEntity>>(
() => VersionedItemEntity.GetFromTFSChanges(entity,chng.Changes));
This is what I want to do (commented)
ChangesetList.Add(
new HistoryLogEntryModel()
{
Revision = changeset.Changeset.ToString(),
Author = changeset.User,
Date = changeset.Date.ToString("dd/MM/yyyy"),
Message = changeset.Comment,
//VersionedItems = changeset.VersionedItems
}
But HistoryLogEntryModel has a different Version of VersionedItems. And I need to convert some variables.If I would convert one thing to another, it would load up everything and that would be unnecessary and slow.
Is this the right approach? How else could I achieve this?
thanks in adv.
~
You should be able to wrap the Lazy<List<T>>
in a Lazy<List<U>>
.
var uLazy = new Lazy<List<U>>(() => tLazy.Value.Select(t => (U)t).ToList());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With