Skip to content

A tool that creates a method containing code equivalent to Linq and calls that method instead.

License

Notifications You must be signed in to change notification settings

aiczk/LinqPatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinqPatcher

A tool that creates a method containing code equivalent to Linq and calls that method instead.

  • Simply attach the [Optimize] attribute to the target method.
  • It can be used simply by attaching attributes.
  • Currently arrays and arguments are supported.

Intoroduction

  1. Download the latest from the LinqPatcher/Release page.
  2. Place an asmdef named Main in any parent folder.
  3. Add LinqPatcherAttribute.dll to Assembly Definitions References.
  4. Done.

Notation in the Code Editor.

[Optimize]
private void Optimize()
{
	IEnumerable<int> num = array.Where(x => x % 2 == 0).Select(x => x * 2);
}

Code called at runtime.

[Optimize]
private void Optimize()
{
	IEnumerable<int> enumerable = e242dad72e884682a5f8424598974110(array);
}

private IEnumerable<int> e242dad72e884682a5f8424598974110(int[] P_0)
{
	if (linq_e242dad72e884682a5f8424598974110.Count > 0)
		linq_e242dad72e884682a5f8424598974110.Clear();

	foreach (int P_1 in P_0)
	{
		if (P_1 % 2 != 0)
		{
			P_1 *= 2;
			linq_e242dad72e884682a5f8424598974110.Add(P_1);
		}
	}

	return linq_e242dad72e884682a5f8424598974110;
}

Currently supported operators

  • Where
  • Select
  • ToList

Releases Note

See here.

License

MIT License

About

A tool that creates a method containing code equivalent to Linq and calls that method instead.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages