string does not contain a definition

SathyanarayananAV 1 Reputation point
2022-09-13T04:21:31.91+00:00

Severity Code Description Project File Line Suppression State
Error CS1061 'string' does not contain a definition for 'GetFileName' and no accessible extension method 'GetFileName' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) SBLT2 D:\Software\SBLTOLD\SBLT2\SriPravanTech\CommonData\getdata.cs 2806 Active

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,187 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,686 Reputation points
    2022-09-13T15:46:12.917+00:00

    the error says the you have the code:

    myObject.GetFileName(...)

    where myObject is a string. or

    "some string".GetFileName(...)

    strings don't have this method. you could have created an string extension method name GetFileName, but it was not found.

    0 comments No comments