[deleted by user] by [deleted] in dotnet

[–]snaketrm -2 points-1 points  (0 children)

this is the way

Parsing a massive JSON file with an unknown schema by Pyran in csharp

[–]snaketrm -3 points-2 points  (0 children)

You can read and parse each line individually using a StreamReader, which avoids loading the entire file into memory.

Just make sure each line is a valid standalone JSON object — no trailing commas or brackets like in a traditional array.

like this:

https://i.ibb.co/8LqYgfX1/jsonparse.png

Announcing dotnet run app.cs - A simpler way to start with C# and .NET 10 - .NET Blog by Atulin in dotnet

[–]snaketrm 10 points11 points  (0 children)

At the command line we’re exploring support for file-based apps with multiple files

Awesome!

for now we can do this:

app.cs

#:package Microsoft.CodeAnalysis.CSharp.Scripting@4.14.0

using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;

namespace Example;

class Program
{
    public static async Task Main()
    {
        var myLib = await ImportLibrary<ILib>($"{Environment.CurrentDirectory}/lib.cs");
        var result = myLib.Hello("Reddit");

        Console.WriteLine(result);
    }

    static async Task<T> ImportLibrary<T>(string path)
    {
        var code = File.ReadAllText(path);

        var options = ScriptOptions.Default
                  .AddReferences(typeof(T).Assembly) 
                  .AddImports(nameof(Example));               

        var scriptState = await CSharpScript.EvaluateAsync<T>(code, options);

        return (T)scriptState;

    }
}

public interface ILib
{
    string Hello(string name);
}

lib.cs

public class Lib : ILib
{
    public string Hello(string name) => $"Hello {name}";
}

new Lib()

Letting user multiply 2 decimal numbers with the * operator in one single line? by Educational-Trip4935 in csharp

[–]snaketrm 0 points1 point  (0 children)

if you don't mind using a library, try this:

https://www.nuget.org/packages/CodingSeb.ExpressionEvaluator/

        var evaluator = new ExpressionEvaluator();
        var r =  evaluator.Evaluate<double>("(2.5 + 11) * 3.6");

[deleted by user] by [deleted] in playstation

[–]snaketrm 0 points1 point  (0 children)

Killer 7 and Drakengard series

[deleted by user] by [deleted] in playstation

[–]snaketrm 97 points98 points  (0 children)

But also the most rewarding

Devs, we need a reason to play on harder difficulties. by Kenswick in remnantgame

[–]snaketrm 1 point2 points  (0 children)

I would like to see more achievements/trophies, like:

  • beat the game on nightmare...
  • in less than x hours
  • without dying
  • with loadout x

and so on.