Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: DynamicAssetArray.Length #3

Open
therealchjones opened this issue Jun 6, 2021 · 0 comments
Open

Feature request: DynamicAssetArray.Length #3

therealchjones opened this issue Jun 6, 2021 · 0 comments

Comments

@therealchjones
Copy link

For various access methods to DynamicAssetArrays, a loop is beneficial (or required); either implementing IEnumerable or a Length (or Count, or whatever) property would improve the ability to do this. As the elems array is internal, this is not cleanly doable with an extension method. For now, I'm using:

		public static int Count( this DynamicAssetArray array ) {
			int length = 0;
			dynamic foo = null;
			try {
				while ( true ) {
					foo = array[length];
					length++;
				}
			} catch ( IndexOutOfRangeException ) {
				return length;
			}
		}

However, this is quite a performance hit for the many DynamicAssetArrays present in the assets I'm examining. Would you be willing to consider this? I'm more than happy to submit a PR if it's something you'd consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant