4.25Setting the Sort Rule for Multipart Form Content Items

Created on Aug 17, 2026~1 min read

Although the need to sort multipart form content items is uncommon, some systems with high security requirements often need to validate the submission order of form fields. The framework provides sorting support for this purpose:

cs
HttpRequestBuilder.Post("https://furion.net")    .SetMultipartContent(multipart =>    {        multipart.AddObject(new { name = "furion", id = 1 });    })    .SetFormItemsSorter(items => items.OrderBy(u => u.Name));

Configure the sort rule for multipart form content items through the .SetFormItemsSorter() method. This method receives the original MultipartFormDataItem collection and returns a sorted enumerable collection. When it is null, no sorting is performed (the original insertion order is used).