Modular Application Creator Use Case Based Documentation
Loading...
Searching...
No Matches
NonTIAProjectBased.cs
1using System.Collections.Generic;
2using System.Linq;
3using Newtonsoft.Json;
4
6
11{
15 public List<ModelToSerialize> ModelList = new();
16
22 public NonTIAProjectBased(string name)
23 {
24 ModelList.Add(new ModelToSerialize(name));
25 CopyModel();
26 }
27
31 public string StringOfAllNames
32 {
33 get { return string.Join(", ", ModelList.Select(x => x.Name)); }
34 }
35
41 public void CopyModel()
42 {
43 var currentModel = ModelList.FirstOrDefault();
44 var jsonOfChannel = JsonConvert.SerializeObject(currentModel, new JsonSerializerSettings());
45 var copyOfChannel =
46 JsonConvert.DeserializeObject<ModelToSerialize>(jsonOfChannel, new JsonSerializerSettings());
47 ModelList.Add(copyOfChannel);
48 }
49}
50
54public class ModelToSerialize
55{
61 [JsonProperty] private string _name;
62
67 public ModelToSerialize(string name) => Name = name;
68
73 [JsonIgnore]
74 public string Name
75 {
76 get => _name;
77 set => _name = value;
78 }
79}
This class is an exemplary model, which is used to demonstrate the MAC serialization process.
string _name
[JsonProperty] means that this attribute will be serialized with its value to get the value again aft...
string Name
[JsonIgnore] means that this attribute will not be serialized. This property gets and sets the "_name...
ModelToSerialize(string name)
Creates a new object of the class and set the name.
string StringOfAllNames
This is the string which will be displayed in the View.
List< ModelToSerialize > ModelList
List of models for serialization.
void CopyModel()
This function gets the first element of the ModelList. Serialize the object, deserialize an object of...
NonTIAProjectBased(string name)
Creates a new object of the class, create a new object of ModelToSerialize and add it to the ModelLis...