borisdj / cscodegenerator Goto Github PK
View Code? Open in Web Editor NEWEasy C# class and code generation
License: MIT License
Easy C# class and code generation
License: MIT License
model:
serviceClassModel.Properties = new List<Property>
{
new(BuiltInDataType.String, "UdtName")
{
AccessModifier = AccessModifier.Public,
KeyWords = new List<KeyWord> { KeyWord.Override },
IsGetOnly = true,
GetterBody = "foo"
}
};
output:
public override string UdtName { get; }
expected:
public override string UdtName => "foo";
public override string UdtName
{
get
{
return "foo";
}
}
UsingDirectives
shouldn't require using
, just add it when writingNamespace
shouldn't require namespace
, just add it when writingConsole.ReadKey()
in CsGenerator
. That isn't an expected behavior.Console.WriteLine
and instead use a logging framework, i.e. Microsoft.Extensions.Logging
Using a simple list of lines works well enough for very simple methods, but as soon as you add even a single if
, it becomes challenging to keep indents correct. Adding some type of fluent builder could go a long way, i.e.
var method = MethodBuilder.Name("Hello")
.AddLine("if (some condition)")
.AddLine("{")
.AddIndent()
.AddLine("Console.WriteLine(\"Hello World\");")
.RemoveIndent()
.AddLine("}")
.Build()
or
var method = MethodBuilder.Name("Hello")
.AddLine("if (some condition)")
.StartScope()
.AddLine("Console.WriteLine(\"Hello World\");")
.EndScope()
.Build()
Hi, you should push out a new version of the nuget with the usability changes in the latest commit. Started using this library now, and was surprised at a couple of things which are corrected in the usability changes you did.
Best,
Stein J. Gran
Zdravo
Currently Comment renders the following:
// my comment
public class MyClass
I would like Comment to render the following:
/// <summary>
/// my comment
/// </summary>
public class MyClass
This will allow the generated code to output XML Documentation
Using Visual Studio 2019. I do not see it in the code base currently, so a bit confused where its coming from, but each time directly after CsGenerator.CreateFiles() the breakpoint does not move on to the next line, and then displays "Press any key to close.".
Not sure if you're seeing the same issue when using the nuget package or not. Otherwise, loving the library so far, and code looks nice and clean.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.