buffer 2.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package buffer --version 2.1.2
                    
NuGet\Install-Package buffer -Version 2.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="buffer" Version="2.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="buffer" Version="2.1.2" />
                    
Directory.Packages.props
<PackageReference Include="buffer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add buffer --version 2.1.2
                    
#r "nuget: buffer, 2.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=buffer&version=2.1.2
                    
Install buffer as a Cake Addin
#tool nuget:?package=buffer&version=2.1.2
                    
Install buffer as a Cake Tool

⚡️ Better Input for C# with buffer

Buffer package in action

Ever wished Console.ReadLine() could give you real-time input? Want full control over what the user types as they type it?

Introducing buffer — a lightweight NuGet package that gives you real-time input handling and total buffer control in C#. Perfect for building interactive CLI tools, REPLs, or anything where ReadLine() just doesn’t cut it.


✨ Features

  • ✅ Real-time updates while users type
  • 🧠 Manual control over the input buffer
  • 🧵 Thread-safe & supports multithreading
  • 🔠 Access buffer as char[] or string
  • 💻 Compatible with a wide range of .NET Frameworks

🚀 Quick Start

🧩 Installation

Add it via CLI:

dotnet add package buffer

Or visit the NuGet page →


🔧 How It Works

  1. Initialize the input buffer
    • With a buffer size
    • Without a buffer size
  2. Start listening for input
  3. Read the buffer manually as char[] or string
  4. Clear the buffer when you’re done

🧪 Example

PradBuffer InputBuffer = new PradBuffer();

// Start capturing input (does NOT return value)
InputBuffer.GetInput();

// Read it manually
string value = InputBuffer.GetBufferAsString();

// Clear when done
InputBuffer.ClearBuffer();

🧩 Manual Buffer Size Example

PradBuffer InputBuffer = new PradBuffer(10);

// Start capturing input (does NOT return value)
InputBuffer.GetInput(); // Only 10 characters can be stored. (0 to 9)

// Read it manually
string value = InputBuffer.GetBufferAsString();

// Clear when done
InputBuffer.ClearBuffer();

🚀 Using its maximum potential

Here is a code example which uses Multithreading to get the input buffer in real-time.

using prad;

class sample_program {
    static PradBuffer buffer = new PradBuffer();

    static void Main(string[] args) {
        Thread thread = new Thread(invoker);
        thread.Start();

        buffer.GetInput("command > ");

        string value = buffer.GetBufferAsString();

        buffer.ClearBuffer();

        Console.WriteLine(value);
    }

    static void invoker(){
        if(buffer.Length > 0)
            Console.WriteLine(buffer.GetBufferAsString());

        Thread.Sleep(1000);
        invoker();
    }
}

🛠️ Unlock the full power of buffer by using multi-threading to get realtime data even before the user has completed typing.


🛠 Overloaded Input Methods

Option 1 – No prompt

InputBuffer.GetInput();
<waits here for input>

Option 2 – With custom prompt

InputBuffer.GetInput("command > ");
command > <waits here for input>

🤝 Contributing

Contributions are always welcome!

Steps

# 1. Fork the repo
# 2. Create a branch
git checkout -b feature-name

# 3. Make changes & commit
git commit -m "Add feature-name"

# 4. Push and open PR
git push origin feature-name

Please:

  • Stick to the existing code style
  • Write helpful commit messages
  • Document new features
  • Add tests when possible ✅


Give it a ⭐ if you like it and share it with your fellow devs!

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.3.1 158 4/14/2025
3.3.0 159 4/14/2025
3.2.0 158 4/14/2025
3.1.0 155 4/14/2025
3.0.0 152 4/13/2025
2.1.3 98 4/13/2025
2.1.2 93 4/13/2025
2.1.1 134 4/9/2025
2.1.0 131 4/9/2025
2.0.1 127 4/8/2025
2.0.0 125 4/8/2025
1.2.0 128 4/7/2025
1.1.3 133 4/6/2025
1.1.2 130 4/6/2025
1.1.1 98 4/6/2025
1.1.0 99 4/6/2025
1.0.0 121 4/1/2025