I found that in visual studio we can add the summary to code easily from creating class Diagram, add class and open Class Details.
Now I want to know if it is possible to export it into an excel file for example.
Check comment from @MD's to this answer https://stackoverflow.com/a/39080107/382515
(Visual Studio go to Analyze menu -> Calculate Code Metrics for Solution then click Excel button on the shown panel. Excel will popup with all your solution namespaces and classes listed. You can filter by class using the Type column)
Credits to @MD's