Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A default value of an optional parameter of a method must be one of the following types of expressions:</p> <p>-a constant expression;</p> <p>-an expression of the form new ValType(), where ValType is a value type, such as an enum or a struct;</p> <p>-an expression of the form default(ValType), where ValType is a value type.</p> <p>Read more <a href="http://msdn.microsoft.com/en-us/library/dd264739.aspx" rel="nofollow">here</a></p> <p>The type of a constant declaration specifies the type of the members that the declaration introduces. The initializer of a constant local or a constant field must be a constant expression that can be implicitly converted to the target type.</p> <p><strong>A constant expression is an expression that can be fully evaluated at compile time</strong>.</p> <p>Therefore, the only possible values for constants of <code>reference types</code> are <code>string</code> and <code>null</code>.</p> <p>Read more <a href="http://msdn.microsoft.com/en-us/library/e6w8fe1b.aspx" rel="nofollow">here</a></p> <p>However, you can achieve this by declaring overloads as follows:</p> <pre><code>private void txtBlockSettings(int _FontSize,FontFamily _FontFamily,FontWeight _FontWeight) { //Some stuff here } private void txtBlockSettings(int FontSize, FontWeight fontWeight ) { txtBlockSettings(FontSize,new FontFamily("Consolas"), fontWeight); } private void txtBlockSettings(int FontSize, FontFamily family) { txtBlockSettings(FontSize, family, FontWeights.Normal); } private void txtBlockSettings(int FontSize) { txtBlockSettings(FontSize, new FontFamily("Consolas"), FontWeights.Normal); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload