Giter Club home page Giter Club logo

more-collections's Introduction

More collections

Provides a set of portable collections installable as source files via NuGet.

Collections / NuGet packages

var map = new Map<int, string>();
map.Add(42, "Hello");
Console.WriteLine(map.Forward[42]); // Outputs "Hello"
Console.WriteLine(map.Reverse["Hello"]); //Outputs 42
 ```

+ <a href="https://www.nuget.org/packages/MoreCollections.CircularList">MoreCollections.CircularList</a>  
List which supports modulo indexing.

``` csharp
var list = new string[]{"one", "two", "three"}.ToList();

var circularList = list.ToCircularList();
Console.WriteLine(circularList[-1]); //outputs "three"
Console.WriteLine(circularList[6]); //outputs "one"
var hist = new History<string>(maxCount: 2);

hist.Add("one");
hist.Add("two");
hist.Add("three");

//outputs: "three", "two"
foreach(var item in hist)
{
   Console.Write(" " + item);
}
var arr = new string[]{"three", "one", "two"};
var indexes = new int[]{1, 2, 0};

var indexedCollection = new IndexedCollection<string>(arr, indexes);

//outputs: "one", "two", "three"
foreach(var item in indexedCollection)
{
   Console.Write(" " + item);
}
var arr = new Point[]{new Point(0, 0), new Point(1, 2) }; //point is struct for (x,y) pair

var pinnedArray = new PinnedArray<Point>(arr); //data is shared

unsafe
{
   Point* pt = (Point*)pinnedArray.Data;
   pt->X = 3;
}

Console.WriteLine(arr[0].X); //outputs "3"
var lazyMatrixCache = new  LazyMemoryCache<int, double[,]>(maxMemoryOccupation: 0.8f);

//load items by calling lazyMatrixCache.AddOrUpdate(<key>, <matrix constructor>)

Console.WriteLine("Is element loaded: " + lazyMatrixCache[10].IsValueCreated); //false
Console.WriteLine("Item (0,0) value: "  + lazyMatrixCache[10].Value[0,0]); //value at (0,0)
Console.WriteLine("Is element loaded: " + lazyMatrixCache[10].IsValueCreated); //true

//elements are automatically evicted if RAM occupation exceeds 80%

How to Engage, Contribute and Provide Feedback

Remember: Your opinion is important and will define the future roadmap.

  • questions, comments - message on Github, or write to: darko.juric2 [at] gmail.com
  • code contributions are welcome
  • spread the word

Final word

If you like the project please star it in order to help to spread the word. That way you will make the framework more significant and in the same time you will motivate me to improve it, so the benefit is mutual.

more-collections's People

Contributors

dajuric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

more-collections's Issues

Clearer licensing

I'd like to use this library, but I'm not entirely clear about the licensing.

Can you maybe make it more explicit?

Thanks!

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.