Process Method

Summary
Processes the specified string.
Syntax
C#
C++
public string Process( 
   T item, 
   string template 
) 
vb[VB Syntax] 
Public Function Process( _ 
   ByVal _item_ As T, _ 
   ByVal _template_ As String _ 
) As String 
public: 
String^ Process(  
   T^ item, 
   String^ template 
)  

Parameters

item
The item to be passed to the Macro substitution delegate.

template
The template to process. This template string should contain macros in the form of ${macro_name}.

Return Value

A string that results from all of the macros being processed in the template.

Example

This example adds two macros to the macro processor and process 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.