Created
August 1, 2019 15:22
-
-
Save controlflow/291b099c81789ebb2196bbec996a21b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ModifyItemsCount(int newCount) | |
{ | |
if (myTail == null || myTail is FrugalLocalMarkerList<T>) | |
{ | |
if (newCount == 0) | |
myTail = null; | |
else if (newCount == 1) | |
myTail = FrugalLocalMarkerList<T>.One; | |
else if (newCount == 2) | |
myTail = FrugalLocalMarkerList<T>.Two; | |
else | |
myTail = new FrugalLocalTailList<T>(newCount); | |
} | |
else | |
{ | |
myTail.ItemsCount = newCount; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ModifyItemsCount(int newCount) | |
{ | |
if (myTail == null || myTail is FrugalLocalMarkerList<T>) | |
{ | |
myTail = newCount switch { | |
0 => null, | |
1 => FrugalLocalMarkerList<T>.One, | |
2 => FrugalLocalMarkerList<T>.Two, | |
_ => new FrugalLocalTailList<T>(newCount) | |
}; | |
} | |
else | |
{ | |
myTail.ItemsCount = newCount; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment