Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Asn1Array.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading.Tasks;
5
7{
11 public class Asn1Array : Asn1Value
12 {
13 private readonly Asn1Value[] values;
14
20 {
21 this.values = Values;
22 }
23
27 public Asn1Value[] Values => this.values;
28
36 public override async Task ExportCSharp(StringBuilder Output, CSharpExportState State,
37 int Indent, CSharpExportPass Pass)
38 {
39 if (Pass == CSharpExportPass.Explicit)
40 {
41 bool First = true;
42
43
44 Output.Append("new ");
45 Output.Append(this.CSharpType);
46 Output.Append(" { ");
47
48 foreach (Asn1Value Value in this.values)
49 {
50 if (First)
51 First = false;
52 else
53 Output.Append(", ");
54
55 await Value.ExportCSharp(Output, State, Indent, Pass);
56 }
57
58 Output.Append(" }");
59 }
60 }
61
65 public override string CSharpType
66 {
67 get
68 {
69 string CommonType = null;
70
71 foreach (Asn1Value Value in this.values)
72 {
73 if (CommonType is null)
74 CommonType = Value.CSharpType;
75 else if (CommonType != Value.CSharpType)
76 return "object[]";
77 }
78
79 return (CommonType ?? "object") + "[]";
80 }
81 }
82
83 }
84}
virtual Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Definition: Asn1Node.cs:46
Abstract base class for values.
Definition: Asn1Value.cs:11
virtual string CSharpType
Corresponding C# type.
Definition: Asn1Value.cs:23
Asn1Array(Asn1Value[] Values)
Array of values
Definition: Asn1Array.cs:19
override string CSharpType
Corresponding C# type.
Definition: Asn1Array.cs:66
override async Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Definition: Asn1Array.cs:36
CSharpExportPass
Defines different C# export passes.
Definition: Asn1Node.cs:12