Why I see red line under this statement

Saeed Pooladzadeh 231 Reputation points
2021-10-08T23:02:03.897+00:00

Hello,

When I want to use these lines I encounter a red line under seek and copy to. And

Warns me up "Are you missing a directive"?
What should I do?

 var state = _instaApi.GetStateDataAsString();


            using (var fileStream = File.Create(stateFile))
            {
                state.Seek(0, SeekOrigin.Begin);
                state.CopyTo(fileStream);
            }

Thanks,

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,212 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,406 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,292 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,319 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 112.7K Reputation points
    2021-10-09T02:38:19.85+00:00

    I think that you should do this:

    var state = _instaApi.GetStateDataAsString( );
    File.WriteAllText( stateFile, state);
    
    0 comments No comments