←Select platform

MacroSubstitutionDelegate<T> Delegate

Summary

Provides a delegate type to be used to process a macro.

Syntax
C#
C++
public delegate string MacroSubstitutionDelegate( 
   T item, 
   string name, 
   object[] parameters 
) 
vb[VB Syntax] 
Public Delegate Function MacroSubstitutionDelegate(Of T)( _ 
   ByVal _item_ As T, _ 
   ByVal _name_ As String, _ 
   ByVal ParamArray _parameters_() As Object _ 
) As String 
generic<typename T> 
public delegate String^ MacroSubstitutionDelegate(  
   _T^_ item, 
   String^ name, 
   ... array<Object^>^ parameters 
) 

Parameters

item The user data passed to the macro process.

name The name of the macro.

parameters The parameters passed to the macro.

Type Parameters

T
Type of user item being passed to the macro process.

Return Value

A string that represents the macro.

Example

This example adds two macros to the macro processor and processes a string.

C#
using Leadtools.Dicom.Common.Anonymization; 
 
 
public void MacroProcessorSample() 
{ 
   MacroProcessor<object> processor = new MacroProcessor<object>(); 
 
   // 
   // add two macros to the macro processor 
   // 
   processor.Macros.Add("current_date", new MacroSubstitutionDelegate<object>(CurrentDateMacro)); 
   processor.Macros.Add("current_time", new MacroSubstitutionDelegate<object>(CurrentTimeMacro)); 
 
   // 
   // Process a macro string 
   // 
   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}")); 
} 
 
private string CurrentDateMacro(object userData, string name, params object[] parameters) 
{ 
   return DateTime.Now.ToShortDateString(); 
} 
 
private string CurrentTimeMacro(object userData, string name, params object[] parameters) 
{ 
   return DateTime.Now.ToShortTimeString(); 
} 
Requirements

Target Platforms

Help Version 22.0.2022.4.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Common Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.