Sign In Register

How can we help you today?

Start a new topic

Unity / C# API, object initializers??

I'm just getting my feet wet with the Unity / C# API.  One of the first things I noticed is the extremely verbose syntax to hydrate a request object:

new DeviceAuthenticationRequest()

It looks like there are no properties on the object for these fields, and you are required to use these methods to hydrate the object.  Have you considered adding properties so we can use object initializers?  It's a more terse syntax that would make a nice alternative, and has some other perks like a filtered auto-complete so you know when the object is fully hydrated without scanning through a big list of Setters:

new DeviceAuthenticationRequest {
    DeviceId = deviceId,
    DeviceModel = deviceModel,
    DeviceName = deviceName,
    DeviceOS = deviceOS,
    DeviceType = deviceType,
    DisplayName = displayName,
    OperatingSystem = operatingSystem,
    Segments = segments,


1 Comment

Hi Ken,

Thanks for the suggestion, I'll pass this on to the dev team. 



Login to post a comment