Skip to content

C# script

Ryan Newington edited this page Apr 12, 2018 · 1 revision

C# script

Summary

This transform allows you to write a basic C# script to transform values

Parameters

Parameter name Description
Script The c# script

Input Type

The transform accepts any input type.

Multiple input values

The transform accepts multiple input values which are processed according to the script

Return Type

The transform return type is determined by the script

Usage

The C# transform contains a single function with the signature

public static IList<object> Transform(IList<object> obj)

The transform is expected to process the incoming objects and return a new List containing one or more transformed values.

This very simple example converts all the incoming values to string, and uppercases the values.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using Lithnet.Transforms;
using Microsoft.MetadirectoryServices;

public static class CSExtension
{
    public static IList<object> Transform(IList<object> obj)
    {
	List<object> transformedItems = new List<object>();
	
	foreach(object value in obj)
	{
	      transformedItems.Add(value.ToString().ToUpper());
	}

	return transformedItems;
    }
}