/// <summary> /// Add Init statement /// </summary> /// <param name="source"></param> private void AddInitStatement(ref string source, TsElementTypes elementType, TsGeneratorOptions options, TsWriteInformation info) { switch (elementType) { //constant case TsElementTypes.Constant: { source = string.Format(TsDomConstants.TS_CONSTANT_SETVALUE_FORMAT, source, InitStatement.GetSource(options, info)); break; } case TsElementTypes.Class: case TsElementTypes.Enumerations: { source = string.Format(TsDomConstants.ASSIGN_FORMAT, source, InitStatement.GetSource(options, info)); break; } case TsElementTypes.InlineObject: { source = string.Format(TsDomConstants.TS_INLINEOBJECT_SETVALUE_FORMAT, source, InitStatement.GetSource(options, info)); break; } default: { throw new NotImplementedException(string.Format("InitStatement for Type ({0}) is not implemented", elementType.ToString())); } } }
/// <summary> /// Constructor /// </summary> /// <param name="typeName"></param> /// <param name="isNullable"></param> public TsCodeTypeReference(string name, TsElementTypes elementType = TsElementTypes.Class) { _name = name; ElementType = elementType; }