Skip to content

Use required properties instead of Constructor Parameters #1456

Description

@TonyValenti

Hi Box Team:
I've notice that in your SDK, required parameters must be provided using constructors.

This means that you have to write code like this:

                    ret = await ApiClient.BoxClient.Folders.CreateFolderAsync(
                        new(SafePathPart, new(ParentId)) {

                        },
                        new() {

                        },
                        new() {

                        },
                        Token
                    ).DefaultAwait(); 

While this works, the more modern way of expressing this is through C#'s required properties. This results in code that is a lot more readable. Something like:

                    ret = await ApiClient.BoxClient.Folders.CreateFolderAsync(
                        new(){
                            ParentId = ParentId,
                            Name = SafeFolderName,
                        },
                        new() {

                        },
                        new() {

                        },
                        Token
                    ).DefaultAwait(); 

Anyway, I wanted to post here and request that ya'll explore this for V11 of the SDK.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions