Skip to content

Feature request: DynamicAssetArray.Length #3

@therealchjones

Description

@therealchjones

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions