I have this currently:
public void Load(IEnumerable<Guid> ids){
f1(ids);
f2(ids);
}
To avoid Resharper squiggles, the suggested fix is something like
public void Load(IEnumerable<Guid> ids){
var enumerable = ids as IList<Guid> ?? ids.ToList();
f1(enumerable);
f2(enumerable);
}
The problem is I can never think of a good name for "enumerable", I don't want to call it idsList, or enumeratedIds, and enumerable certainly won't work, and ids is already used for the parameter. So my actual question is will this solve both problems?
public void Load(IEnumerable<Guid> ids){
ids = ids as IList<Guid> ?? ids.ToList();
f1(ids);
f2(ids);
}
Are there situations where the above would yield unexpected/inefficient results?