Open sandboxFocus

Property IsRequired

IsRequired

Gets or sets a value indicating whether the target method must have a return value. When this property is true, the compiler reports an error when the method of a method boundary advice returns void, returns a task without a result, returns by reference (ref or ref readonly), or is an iterator, and when the method of an OnMethodInvokeAdvice returns void. When it is false, the parameter receives the default value of its type in these methods, and a value that the advice writes to an out or ref parameter is ignored. The default value is false.

Declaration
public bool IsRequired { get; set; }
Property Value
Type Description
bool
Remarks

When the advice is selected by MatchPointcut, a target method without a return value is skipped, and no error is reported for it.