Code Monkey home page Code Monkey logo

ringbuffer.net's Introduction

RingBuffer

By Joe Osborne

Description

RingBuffer is a simple C# implementation of a ring (circular) buffer for C#. It is generic, and implements the .Net IEnumerable and IEnumerable interfaces.

Usage

using RingBuffer; // The RingBuffer<T> class is in the RingBuffer namespace.

//...

RingBuffer<int> buffer = new RingBuffer<int>(); // Declares and initialises a new integer ring buffer with default size (4).

buffer.Put(3); // Adds 3 as an item to the buffer

int result = buffer.Get(); // Declares variable result and assigns it to the oldest element in the buffer. Removes this element from the buffer.

buffer.Size; // The number of elements currently contained in the buffer.

buffer.Capacity; // The number of elements the buffer can store.

foreach(int item in buffer){ //Sets each element stored in the buffer to 0.
	i = 0;
}

Including in a Project

Releases on GitHub include a .dll including the RingBuffer functionality, which can be included as a build reference in any project.

RingBuffer can also be built as is to create a .dll which can be referenced by any other project. RingBuffer.cs can also be included in any project and will allow use of the RingBuffer class.

Requirements

RingBuffer is built targeting the .NET framework V3.5. As such, the release .dll will only work in projects targeting at least .NET 3.5. The code should however work with .NET 2.0 onwards.

Contributing

All suggestions are welcome, in the form of pull requests or messages.

License

RingBuffer is released under the GNU GPL V3.0

ringbuffer.net's People

Contributors

ettmetal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.