Normal
Hey guys, new here, been checking out the project. Was looking at this section because I am planning on helping out, I've been working with Managed DirectX for 1.5 years and C# for 4, so hopefully I can add something useful. Anyway I thought I'd give you my 2c on some styles which I've found to be very useful when coding.The first style is with regard to /// xml comments; if you look at Microsoft C# code (the Managed DirectX samples are a good example), they often "in-line" their summaries on variables and I've found this makes things a hell of a lot more readable, since you can view at least three times as many variables per page and your code isn't littered with /// lines. E.g[code]///<summary>This is the music playlist</summary>ArrayList MusicPlaylist = new PlayList();///<summary>This is the movie playlist</summary>ArrayList MoviePlaylist = new PlayList();// as opposed to:///<summary>///This is the music playlist///</summary>ArrayList MusicPlaylist = new PlayList();...[/code]Although you're probably going to cringe at first (as I did) it just works so well for short comments, so much so that the Whidbey team have said in Orcas they're going to make it an option to have xml comments in this style. Also works well for methods, in fact it's generally much tidier when you're only using single-line summaries. I still suggest multi-line summaries get the full works.Second thing to get the "inline" treatment is Properties. Again, it seems so wrong to mix inline and line broken code, but once again it just works so well. Example:[code]public class SomeClass{ private int m_Playlist; public int Playlist { get { return m_Playlist; } set { m_Playlist = value; } }}[/code]Now obviously if you're going to have more than just a standard assignments inside your Properties it makes more sense for you to use multi-line; but for something so simple the inline approach is very readable and looks tidy. I haven't come across any other situations where inline code is better, just with Properties since they are so predictable (i.e. return x; x = value)Of course, I'm just passing on some useful styles that I've encountered during my time coding C#; which I've also seen implimented by others (e.g. MDX team). I don't mean to come barging in with like "HEY DO IT MY WAY!!". But I do recommend you try converting a class with a lot of Properties and XML comments into these styles and see how you feel about it. Like I said, I was sceptical at first.With best intentions,Koni
Hey guys, new here, been checking out the project. Was looking at this section because I am planning on helping out, I've been working with Managed DirectX for 1.5 years and C# for 4, so hopefully I can add something useful. Anyway I thought I'd give you my 2c on some styles which I've found to be very useful when coding.
The first style is with regard to /// xml comments; if you look at Microsoft C# code (the Managed DirectX samples are a good example), they often "in-line" their summaries on variables and I've found this makes things a hell of a lot more readable, since you can view at least three times as many variables per page and your code isn't littered with /// lines. E.g
[code]
///<summary>This is the music playlist</summary>
ArrayList MusicPlaylist = new PlayList();
///<summary>This is the movie playlist</summary>
ArrayList MoviePlaylist = new PlayList();
// as opposed to:
///<summary>
///This is the music playlist
///</summary>
...
[/code]
Although you're probably going to cringe at first (as I did) it just works so well for short comments, so much so that the Whidbey team have said in Orcas they're going to make it an option to have xml comments in this style. Also works well for methods, in fact it's generally much tidier when you're only using single-line summaries. I still suggest multi-line summaries get the full works.
Second thing to get the "inline" treatment is Properties. Again, it seems so wrong to mix inline and line broken code, but once again it just works so well. Example:
public class SomeClass
{
private int m_Playlist;
public int Playlist { get { return m_Playlist; } set { m_Playlist = value; } }
}
Now obviously if you're going to have more than just a standard assignments inside your Properties it makes more sense for you to use multi-line; but for something so simple the inline approach is very readable and looks tidy. I haven't come across any other situations where inline code is better, just with Properties since they are so predictable (i.e. return x; x = value)
Of course, I'm just passing on some useful styles that I've encountered during my time coding C#; which I've also seen implimented by others (e.g. MDX team). I don't mean to come barging in with like "HEY DO IT MY WAY!!". But I do recommend you try converting a class with a lot of Properties and XML comments into these styles and see how you feel about it. Like I said, I was sceptical at first.
With best intentions,
Koni