public InterfaceProperty(TypeName typeName, String name, Boolean get, Boolean set) { this.TypeName = typeName; this.Name = name; this.Get = get; this.Set = set; }
public void TypeNameWithGenericTypes() { var tp = new TypeName("Func"); tp.GenericTypes.Add(new TypeName("String")); tp.GenericTypes.Add(new TypeName("Int32")); Assert.AreEqual("Func<String, Int32>", SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, tp)); Assert.AreEqual("Func(Of String, Int32)", SourceCodeGenerator.Write(SourceCodeLanguage.VB, tp)); }
public Property(TypeName typeName, String name) { this.Attributes = new List<string>(); this.Modifier = new MethodModifier(MethodAccessModifier.Public); this.TypeName = typeName; this.Name = name; this.Get = new PropertyBody(PropertyBodyType.Get); this.Set = new PropertyBody(PropertyBodyType.Set); }
public void TypeNameWithNestedGenericTypes() { var tp = new TypeName("Func"); tp.GenericTypes.Add(new TypeName("String")); var tp1 = new TypeName("Action"); tp1.GenericTypes.Add(new TypeName("String")); tp1.GenericTypes.Add(new TypeName("Int32")); tp.GenericTypes.Add(tp1); Assert.AreEqual("Func<String, Action<String, Int32>>", SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, tp)); Assert.AreEqual("Func(Of String, Action(Of String, Int32))", SourceCodeGenerator.Write(SourceCodeLanguage.VB, tp)); }
public override void Write(TypeName typeName) { var writer = this.TextWriter; writer.Write(typeName.Name); if (typeName.GenericTypes.Count > 0) { writer.Write("(Of "); for (int i = 0; i < typeName.GenericTypes.Count; i++) { var tp = typeName.GenericTypes[i]; this.Write(tp); if (i < typeName.GenericTypes.Count - 1) { writer.Write(", "); } } writer.Write(")"); } }
public MethodParameter(TypeName typeName, String name) { this.TypeName = typeName; this.Name = name; }
public Field(TypeName typeName, String name) { this.Modifier = new FieldModifier(); this.TypeName = typeName; this.Name = name; }
public void TypeNameWithoutGenericTypes() { var tp = new TypeName("Int32"); Assert.AreEqual("Int32", SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, tp)); Assert.AreEqual("Int32", SourceCodeGenerator.Write(SourceCodeLanguage.VB, tp)); }
public static String Write(SourceCodeLanguage language, TypeName typeName) { var sc = Create(language); sc.Write(typeName); return sc.TextWriter.ToString(); }
public abstract void Write(TypeName typeName);