Owl
Owl
CC#
Created by Owl on 5/23/2023 in #help
❔ Learning C#, and curious about advanced return statements...
I'm jumping right into the depts and wish to return a new object of 'Buffer' type and construct it with lambda. The instruction should be to create Buffer object and write .txt file to Buffer.contents. Can someone teach me how to make that happen with a single statement?
using System.IO;

public struct Buffer
{
public string[] contents;
}

public Buffer ReadFromFile(System.IO.File _file)
{
return &Buffer();() => _file.ToString();
}
using System.IO;

public struct Buffer
{
public string[] contents;
}

public Buffer ReadFromFile(System.IO.File _file)
{
return &Buffer();() => _file.ToString();
}
(new to C#, so please be gentle)
32 replies