This project is read-only.

Recommended best practises

Apr 13, 2008 at 9:49 PM
Setting debug assertions where they are useful

DiffuseMaterial mat = this.GeometryModel.Material as DiffuseMaterial;
System.Diagnostics.Debug.Assert(mat != null);

In the example below Material is set somewhere else and can be several types other that DiffuseMaterial, but we need it to be a diffuse material for the rest of the code to work. So we assert for the value of mat before continuing. an alternative for this code would be:

Material mat = this.GeometryModel.Material;
System.Diagnostics.Debug.Assert(mat is DiffuseMaterial);