This is the first exercise I did when I first got into my internship-output a diamond in the console.
After a few months of access to C #, it turned out to be the first time you touch the console ,--.
This is the prototype of the battle.
A lot of tricks,CodeAbstract.
I am still familiar with winform and plan to print diamond in winform.
I tried to call the console for output, but the effect was not good.
The key is that you can call the console in winform. The method is as follows:
[System. Security. suppressunmanagedcodesecurity] [dllimport ("Kernel32", charset = charset. Auto)] Static extern bool allocconsole (); // you can call allocconsole () again.
We also need to change the code to object-oriented. After studying what is Object-oriented for a long time, we found that for so long,
I think I know something about object-oriented. In the end, it is the opposite. I should be called process-oriented programming...
--| Or neither of them. If you are a programmer like me, there is no such thing as weird...
Or lay a good foundation for programming...
Source code download
<Console _ Drawing a diamond OOP> the modified version deletes unnecessary code and Implements similar methods,
Nothing changed. The output method is transplanted to the diamond class. It should be similar. XD