Set default Color parameter value

public void Test(Color foreColor = Color.Black) doesn’t work (error message Default parameter value for ‘parameter’ must be a compile-time constant) beacause Color.Black isn’t a constant value (Color is a struct).

Solution:
public void Test(Color? foreColor = null)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.