Hi everyone!
I create a Source Code file, and describe in it two classes: Car and Person.
Here full code:
using System;
using System.Collections.Generic;
namespace LetsTest
{
public class SourceFile
{
}
public class Car
{
public string Make { get; private set; }
public string Model { get; private set; }
public int Year { get; private set; }
public Car(string make, string model, int year)
{
Make = make;
Model = model;
Year = year;
}
public void DisplayInfo()
{
Console.WriteLine($"Car: {Year} {Make} {Model}");
}
}
public class Person
{
public string FirstName { get; private set; }
public string LastName { get; private set; }
public int Age { get; private set; }
public List<Car> Cars { get; private set; }
public Person(string firstName, string lastName, int age)
{
FirstName = firstName;
LastName = lastName;
Age = age;
Cars = new List<Car>();
}
public void BuyCar(Car car)
{
Cars.Add(car);
}
public void DisplayInfo()
{
Console.WriteLine($"Person: {FirstName} {LastName}, Age: {Age}");
Console.WriteLine("Cars owned:");
foreach (var car in Cars)
{
car.DisplayInfo();
}
}
}
}
I can create in low-code workflow two assigns and describe objects car and person, but how can I execute person.BuyCar(car) function?
It’s NOT a static function, so I can’t use Invoke Method. Are there any solutions?
Unfortunately, I don’t know any low-code activities that can execute void functions.
TIA