Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error CS0417 

Error Message

'identifier': cannot provide arguments when creating an instance of a variable type

This error occurs if a call to the new operator on a type parameter has arguments. The only constructor that can be called using the new operator on an unknown parameter type is a constructor with no arguments. If you need to call another constructor, consider using a class type constraint or interface constraint.


The following example generates CS0417:

// CS0417
class C<T> where T : new()
    T type = new T(1);   // CS0417

Community Additions

© 2015 Microsoft