Klarth
Klarth
CC#
Created by Klarth on 9/25/2024 in #help
Data structure options for UI virtualization
I'm trying to find a good data structure for UI virtualization of collection controls to keep track of each control's estimated dimensions. Virtualization is (eg.) when you have a million data rows and only 10 can fit on screen, so you only create 10 controls. As the user scrolls, controls that move offscreen are recycled (returned to pool) and rows that now appear onscreen are materialized as controls. Because only on-screen controls exist, I cannot store row-specific metadata on them to later retrieve because they get wiped during recycling. The main problem I'm trying to solve is obtaining the total height of all rows when row heights can vary: combining actual measurements from rows that have been previously materialized and estimated heights for ones that haven't. While I could store row height information in a standard array, typical insert and delete operations will result in large move operations. I'm looking for a better solution than one giant array (or an array of chunks). Ideally, I could index the structure by the row ID in the collection control (ie. [0-1,000,000]), but I could also accept an ID that's stored on the data (instead of part of UI). I'm worried about Dictionary having an unacceptably large memory footprint.
5 replies
CC#
Created by Klarth on 7/14/2024 in #help
API versioning from NuGet Packages
I'm trying to sort out version documentation for a library similar to what .NET does regarding its API availability in docs. The particular project is large and not the easiest to build from source, so I'm looking for advice (available packages/tools) to: 1. download a NuGet package for a version. 2. fetch public APIs. 3. store them in a DB or other persistence under the version. 4. repeat for several versions. I'd rather not reinvent the wheel if not necessary. Eventually this is intended to be used in doc generation, but I'm not sure which. .NET previously used docfx (which worked ok for single version for me, besides needing to build), but they moved to something else, IIRC.
1 replies
CC#
Created by Klarth on 11/18/2022 in #help
Nullable approach with property defined in base and initialized in derived classes [Answered]
Is there an approach for the Base.Some property besides changing it to SomeType? or suppressing with = null!;. I want to defer the creation and leave it up to a derived class.
public abstract class Base
{
public SomeType Some { get; set; }
}

public class DerivedA : Base
{
public DerivedA()
{
Some = new SomeType(1, 2, 3);
}
}

public class DerivedB : Base
{
public DerivedB()
{
Some = new SomeType(9, 8, 7);
}
}

public class SomeType
{
public SomeType(int a, int b, int c) { }
}
public abstract class Base
{
public SomeType Some { get; set; }
}

public class DerivedA : Base
{
public DerivedA()
{
Some = new SomeType(1, 2, 3);
}
}

public class DerivedB : Base
{
public DerivedB()
{
Some = new SomeType(9, 8, 7);
}
}

public class SomeType
{
public SomeType(int a, int b, int c) { }
}
18 replies