Skip to content

Implementation of some Underscore.js feature in .NET, using C#

Notifications You must be signed in to change notification settings

zpbappi/underscore-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Underscore.Net

Build status

Implementation of some Underscore.js feature in .NET, using C#. If you are a Underscore.js fan and a .NET developer, you will find this library quite interesting.

We will cover Functions part of Underscore.js first. Then we'll move on to other features.

FYI, for Actions with generic type arguments, we have currently limited the number of argument to 4. If required, we will increment it later.

Current support

  • _.Once(...)
  • _.Debounce(...)
  • _.Throttle(...)
  • _.Negate(...)

Usage

First, add the using statement in your file as:

using UnderscoreNet

Then, simply use the methods as you would in Underscore.js.

Example:

using UnderscoreNet;
public class Test
{
	public static void DoSomething()
	{
		Console.WriteLine("Doing something...");
	}

	public static void Test()
	{
		var action = Underscore.Once(DoSomething);
		action(); // DoSomething gets called here.
		action(); // does nothing for this and all subsequent calls
		action();
		action();
	}
}

For somewhat realistic use, please see the example in this blog post.

Please refer to the Underscore.Specs folder for tests with more usage.

For hardcore Underscore.js fans

using _ = UnderscoreNet.Underscore; // if you know what i mean ;)

About

Implementation of some Underscore.js feature in .NET, using C#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages