Hopefully I’ve just done something dumb but I get an int array and I want to assign that to a property – but even though the int array is not null, when I assign it to the property it is null. Note this is broken into several statements as I was testing that my select statement worked ok.
int[] placementslist = selfSelPlacements.Select(p => p == null ? 0 : p.PlacementId).ToArray<int>();
I have tried
UnitOfferingListCriteria.Placements = new int[placementslist.Length];
as well as just assigning
UnitOfferingListCriteria.Placements = placementslist;
But UnitOfferingListCriteria.Placements is always null despite placementslist having 1 item.
In my class for the property
public int[] Placements { get; set; }
If someone could point out what I’m doing wrong – thanks!
Edit – thanks for the suggestions, been swamped with other stuff so haven’t had a chance to get back to it yet.
will have a default value of null.
Is
UnitOfferingListCriteriaa class or a class instance? It looks like you are doing something with a static property? Or are you accessing a property on a property?