Borrar filtros
Borrar filtros

Pass parameters to .NET Constructor

1 visualización (últimos 30 días)
Dimitrii Nikolaev
Dimitrii Nikolaev el 22 de Jun. de 2021
Consider a .NET Assembly Assembly with a class Person with some set of properties like Age, FirstName, LastName, Address, and a constructor P = new Person().
In C# it is possible to predefine some fields right on contruction stage by using curly braces
C#:
var x = new Assembly.Person {FirstName="Homer",LastName="Simpson",Age=47};
Equal code would look in MATLAB like
MATLAB:
x = Assembly.Person();
x.FirstName = "Homer";
x.LastName = "Simpson";
x.Age = 47;
--> Is there a better, more compact way to construct such object in Matlab?

Respuestas (0)

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by