Вопрос

In vb.net, is it possible to initialize, set, and Return a Structure inline?

If I have this Structure

Structure CopyAndPasteUniquesAndExistenceStructure
    Dim duplicatePoints As List(Of Array)
    Dim inexistentPoints As List(Of Array)
    Dim insertedRows As List(Of Object)
End Structure

How can I do this pseudo?

Return New CopyAndPasteUniquesAndExistenceStructure...
Это было полезно?

Решение

Return New CopyAndPasteUniquesAndExistenceStructure With {.duplicatePoints = New List(Of Array), .inexistentPoints = New List(Of Array), .insertedRows = New List(Of Object)}

Or you can add a specialized constructor. This is useful if you want to validate the input, or if you want to make the lists read-only (which usually makes a lot of sense for lists).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top