Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error CS1110

Visual Studio 2008

Cannot use 'this' modifier on first parameter of method declaration without a reference to System.Core.dll. Add a reference to System.Core.dll or remove 'this' modifier from the method declaration.

Extension methods are supported on version 3.5 and later of the .NET Framework. Extension methods generate metadata which marks the method with an attribute. The attribute class is in system.core.dll.

To correct this error

  • As the message states, add a reference to System.Core.dll or remove the this modifier from the method declaration.

The following example generates CS1110 if the file is not compiled with a reference to System.Core.dll:

// cs1110.cs
// CS1110
// Compile with: /target:library
public static class Extensions
{
    public static bool Test(this bool b) { return b; }
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.