My friend decided to start writing a book about "Advanced Topics in C#". But really there are a lot of books about c# and about programming languages in general , so is it still worth to write a programming book like that as a commercial job ?
As a commercial job? Almost certainly not.
Obviously I only know about the books I've written or contributed to, but none of them have paid particularly well. Clearly there are some very successful books out there, but they're few and far between - and even then I suspect the money's not terribly good compared with what you can earn for actually coding.
On the other hand, as a way of improving your communication skills and deepening your knowledge, writing is great. You can do that individually on a blog of course, rather than worrying about finding a publisher etc. Being "properly" published comes with ego benefits, mind you... and it's a good way of forcing yourself to be disciplined in your writing. There's a lot to learn from the editing process, as well as tech reviewing1. I wouldn't want to actively discourage anyone from writing a book. Just be aware that it's a lot of work, and it's not going to make you rich. You really need to do it for the love of the thing.
1 If you can find a tech reviewer of Eric Lippert's calibre, it's almost worth writing a book just to get their feedback.
Is it about profiting or contributing? If it is about contributing and you can differentiate yourself from the myriad of other book authors, go for it! If it is about profiting, only, it just isn't worth the months if not years you would have to invest, to make maybe tens of thousands of dollars tops. This is of course assuming that you have a decent software developer job at the moment.
Charles Petzold has written before about the economics of writing programming books.
I wrote a book aimed at beginners using a BASIC (PureBasic) dialect about five years ago. Even though it was aimed at novices, i included an advanced section on pointers, threading, binary operations and windows programming using the Win32 API. If nothing else it made me get my facts straight and made me research to learn everything in depth.
It was a great boost to my confidence as a programmer that every one who read it complimented me on my writing and knowledge. Even the authors of the language reviewed it with great approval.
It won't make you rich, but writing a book will make you get your facts straight about the technology your writing about, otherwise your going to look foolish!
By the way, i used print on demand to keep the costs down and i sold way more than i anticipated! Which was nice! (i made just over £5k) If you want to read it, it's in my profile released under creative commons. :o)