我有一个来自 BioJava 库的 Java 枚举器缩短为以下内容:
public enum Element implements Serializable {
// most frequently used elements first
H(1, 1, 39, 1.10f, 0.32f, 1, 1, 1, 1, 1, 1.008f, 0, 1, 2.20f, ElementType.OTHER_NONMETAL),
C(6, 2, 0, 1.55f, 0.77f, 4, 4, 4, 4, 4, 12.011f, 2, -4, 2.55f, ElementType.OTHER_NONMETAL),
N(7, 2, 57, 1.40f, 0.75f, 5, 2, 5, 3, 4, 14.007f, 2, -3, 3.04f, ElementType.OTHER_NONMETAL),
O(8, 2, 65, 1.35f, 0.73f, 6, 1, 2, 2, 2, 16.000f, 2, -2, 3.44f, ElementType.OTHER_NONMETAL),
.....
private int atomicNumber;
private int period;
private float VDWRadius; // in Angstroms
private float covalentRadius; // in Angstroms
private int valenceElectronCount;
private int minimumValence;
private int maximumValence;
private int commonValence;
private int maximumCovalentValence;
private float atomicMass;
private int coreElectronCount;
private int oxidationState;
private float paulingElectronegativity;
private ElementType elementType;
private static final Map<String,Element> allElements ;
static {
allElements = new HashMap<String,Element>();
for (Element e : Element.values()){
allElements.put(e.toString().toLowerCase(), e);
}
}
private Element(int atomicNumber,
int period,
int hillOrder,
float VDWRadius,
float covalentRadius,
int valenceElectronCount,
int minimumValence,
int maximumValence,
int commonValence,
int maximumCovalentValence,
float atomicMass,
int coreElectronCount,
int oxidationState,
float paulingElectronegativity,
ElementType elementType) {
this.atomicNumber = atomicNumber;
this.period = period;
//this.hillOrder = hillOrder;
this.VDWRadius = VDWRadius;
this.covalentRadius = covalentRadius;
this.valenceElectronCount = valenceElectronCount;
this.minimumValence = minimumValence;
this.maximumValence = maximumValence;
this.commonValence = commonValence;
this.maximumCovalentValence = maximumCovalentValence;
this.atomicMass = atomicMass;
this.coreElectronCount = coreElectronCount;
this.oxidationState = oxidationState;
this.paulingElectronegativity = paulingElectronegativity;
this.elementType = elementType;
}
我想简单地将这个结构移植到 C#,其中有一个元素的枚举,并附有 Element 的基本信息。我该怎么做?
优选地,该解决方案将是内存有效的。