Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example
Code Block
csharp
csharp
titleC#
        public FunctionValue Calculate(IList<FunctionValue> args, Cell currentCell)
        {
            StringBuilder result = new StringBuilder("");
             foreach (FunctionValue arg in args)
            if ({
                result.Append(',');
                switch (arg.Type)
!= FunctionValueType.RANGE)
                   {
                    case FunctionValueType.BOOLEAN:
                        result.Append((bool)arg.Value ? "True" : "False");
                        break;
                    case FunctionValueType.STRING:
                        result.Append(arg.Value);
                        break;
                    case FunctionValueType.NUMBER:
                        result.Append(((double)arg.Value).ToString("0.#####"));
                        break;
                    case FunctionValueType.NULL:
                        result.Append(' ');
                        break;
                    case FunctionValueType.RANGE:
                        result.Append(arg.Value.ToString());
                        break;
                }
            }
            return new FunctionValue(result.ToString());
        }
Code Block
vb.net
vb.net
titlevb.net
    Public Function Calculate(args As IList(Of FunctionValue), currentCell As Cell) As FunctionValue
        Dim result As New StringBuilder("")
        For Each arg As v In args
            If arg.Type <> FunctionValueType.RANGE Then
                result.Append(arg)
            End If
        Next
        Return New FunctionValue(result.ToString())
    End Function