/// <summary> /// Gets the source code corresponding to the expression. /// </summary> /// <param name="writer">The stream on which to write.</param> /// <param name="expressionContext">The context.</param> /// <param name="skippedIndex">Index of a destination to skip.</param> public override void WriteCSharp(ICSharpWriter writer, ICSharpExpressionContext expressionContext, int skippedIndex) { Debug.Assert(WriteDown); string TypeText; string ClassName; string ConstantName; if (Feature != null) { TypeText = string.Empty; if (Class.ValidSourceName == "Microsoft .NET") { ClassName = CSharpNames.ToDotNetIdentifier(Class.ValidClassName); ConstantName = CSharpNames.ToDotNetIdentifier(Feature.Name); } else { ClassName = CSharpNames.ToCSharpIdentifier(Class.ValidClassName); ConstantName = CSharpNames.ToCSharpIdentifier(Feature.Name); } } else { TypeText = "(int)"; if (Class.HasDiscreteWithUnkownValue) { ClassName = CSharpNames.ToCSharpIdentifier(Class.ValidClassName) + "_Enum"; } else { ClassName = CSharpNames.ToCSharpIdentifier(Class.ValidClassName); } ConstantName = CSharpNames.ToCSharpIdentifier(Discrete.Name); } expressionContext.SetSingleReturnValue($"{TypeText}{ClassName}.{ConstantName}"); }