Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim c As System.Drawing.Color If c <> Nothing Then MessageBox.Show(c.Name) Else MessageBox.Show("null") End If End Sub Public Enum Align Left Center Right End Enum Public Alignment As Align Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click If Alignment <> Nothing Then MessageBox.Show("true") Else MessageBox.Show("false") End If End Sub
private void button1_Click(object sender, EventArgs e) { System.Drawing.Color c = default(System.Drawing.Color); if (c != null) { MessageBox.Show(c.Name); } else { MessageBox.Show("null"); } } public enum Align { Left, Center, Right } public Align Alignment; private void button2_Click(object sender, EventArgs e) { if (Alignment != null) { MessageBox.Show("true"); } else { MessageBox.Show("false"); } }
null
Nothing
default(T)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)