FunctionX 0.1.13
dotnet add package FunctionX --version 0.1.13
NuGet\Install-Package FunctionX -Version 0.1.13
<PackageReference Include="FunctionX" Version="0.1.13" />
paket add FunctionX --version 0.1.13
#r "nuget: FunctionX, 0.1.13"
// Install FunctionX as a Cake Addin #addin nuget:?package=FunctionX&version=0.1.13 // Install FunctionX as a Cake Tool #tool nuget:?package=FunctionX&version=0.1.13
FunctionX
The FunctionX library implements Excel-like formula functionality in C#. It allows users to manipulate data in a similar way to Excel formulas. The library runs scripts in the Roslyn compiler to evaluate expressions.
Features
The FunctionX library offers the following features:
Usage
To use the FunctionX library:
- Call the
Fx.Evaluate
method to evaluate a formula. - Pass the formula string and a dictionary of parameters.
Examples
Here are some examples of using the FunctionX library:
// Basic mathematical operation
var result = await Fx.EvaluateAsync("1 + 2 + 3");
// Calculate the average value in an array
var parameters = new Dictionary<string, object?>
{
{ "myArray", new object[] {1, 2, 3, 4, 5} }
};
var average = await Fx.EvaluateAsync("AVERAGE(@myArray)", parameters);
// Conditional logic
var parameters = new Dictionary<string, object?>
{
{ "value1", 10 },
{ "value2", 20 }
};
var ifResult = await Fx.EvaluateAsync("IF(@value1 > @value2, \"Yes\", \"No\")", parameters);
Implemented Functions
Function Name | Description |
---|---|
SUM |
Calculates the sum of numeric values. |
AVERAGE |
Calculates the average of numeric values. |
MAX |
Finds the maximum value among numeric values. |
MIN |
Finds the minimum value among numeric values. |
COUNT |
Counts the number of numeric values. |
COUNTA |
Counts the number of non-empty values. |
AND |
Returns true if all values are true. |
OR |
Returns true if at least one value is true. |
NOT |
Returns true if the value is false. |
XOR |
Returns true if an odd number of values are true. |
IF |
Returns one of two values depending on a condition. |
IFS |
Returns the result of the first true condition among multiple conditions. |
SWITCH |
Returns a value based on given cases or provides a default value. |
CONCAT |
Concatenates string values. |
LEFT |
Returns a specified number of characters from the beginning of a string. |
RIGHT |
Returns a specified number of characters from the end of a string. |
MID |
Returns a specified number of characters from a string starting at a specified position. |
TRIM |
Removes leading and trailing whitespace from a string. |
UPPER |
Converts a string to uppercase. |
LOWER |
Converts a string to lowercase. |
PROPER |
Converts the first letter of each word in a string to uppercase. |
REPLACE |
Replaces occurrences of a specified substring within a string with another substring. |
LEN |
Returns the length of a string. |
INDEX |
Returns the value at a specified position in an array or dictionary. |
VLOOKUP |
Searches for a value in the first column of a range and returns a value in the same row from a specified column. |
UNIQUE |
Returns an array of unique values with duplicates removed. |
IFERROR |
Returns a value if an expression results in an error. |
Installation
This library is not currently available via NuGet. To use the library, you will need to download the source code directly and include it in your project.
Requirements
- netstandard2.1
Contributing
FunctionX is an open-source project. If you would like to contribute, please send a pull request or file an issue.
License
The FunctionX library is provided under the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net5.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net6.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net7.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net8.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.