My angular frontend is sending an object with index signature to a .NET Core controller. It looks something like this:
export interface LazyLoadEvent {
first?: number;
rows?: number;
filters?: {
[s: string]: FilterMetadata;
};
}
export interface FilterMetadata {
value?: any;
matchMode?: string;
operator?: string;
}
I am trying to create models in C# to handle requests like this. I am unsure of how to construct the property filter in C#. What would be the equivalent of TypeScript Index Signatures implementation in C#?
From typescriptlang: Index Signatures Sometimes you don’t know all the names of a type’s properties ahead of time, but you do know the shape of the values. In those cases you can use an index signature to describe the types of possible values.