Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
GenericObjectPropertyEnumerator.cs
1using System;
3using System.Threading.Tasks;
11
13{
18 {
23 {
24 }
25
31 public Task<IElement> EnumerateProperties(object Object)
32 {
33 if (Object is GenericObject Obj)
34 {
36
37 if (!string.IsNullOrEmpty(Obj.CollectionName) && !Obj.TryGetFieldValue("CollectionName", out object _))
38 {
39 Elements.Add(new StringValue("CollectionName"));
40 Elements.Add(Expression.Encapsulate(Obj.CollectionName));
41 }
42
43 if (!string.IsNullOrEmpty(Obj.TypeName) && !Obj.TryGetFieldValue("TypeName", out object _))
44 {
45 Elements.Add(new StringValue("TypeName"));
46 Elements.Add(Expression.Encapsulate(Obj.TypeName));
47 }
48
49 if (Obj.ObjectId != Guid.Empty && !Obj.TryGetFieldValue("ObjectId", out object _))
50 {
51 Elements.Add(new StringValue("ObjectId"));
52 Elements.Add(Expression.Encapsulate(Obj.ObjectId));
53 }
54
55 foreach (KeyValuePair<string, object> P in Obj.Properties)
56 {
57 Elements.Add(new StringValue(P.Key));
58 Elements.Add(Expression.Encapsulate(P.Value));
59 }
60
61 ObjectMatrix M = new ObjectMatrix(Elements.Count / 2, 2, Elements)
62 {
63 ColumnNames = new string[] { "Name", "Value" }
64 };
65
66 return Task.FromResult<IElement>(M);
67 }
68 else
69 return Task.FromResult<IElement>(ObjectValue.Null);
70 }
71
77 public Grade Supports(Type Object)
78 {
79 if (Object == typeof(GenericObject))
80 return Grade.Ok;
81 else
82 return Grade.NotAtAll;
83 }
84 }
85}
Generic object. Contains a sequence of properties.
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
void Add(T Item)
Adds an item to the collection.
Definition: ChunkedList.cs:272
Class managing a script expression.
Definition: Expression.cs:41
static IElement Encapsulate(object Value)
Encapsulates an object.
Definition: Expression.cs:5241
static readonly ObjectValue Null
Null value.
Definition: ObjectValue.cs:88
GenericObjectPropertyEnumerator()
Enumerates properties in a GenericObject object.
Grade Supports(Type Object)
If the interface understands objects such as Object .
Task< IElement > EnumerateProperties(object Object)
Enumerates the properties of an object (of a type it supports).
Basic interface for all types of elements.
Definition: IElement.cs:21
Definition: ImplTypes.g.cs:58
Grade
Grade enumeration
Definition: Grade.cs:7