Mega Code Archive

 
Categories / C# / Reflection
 

Integration Property To String

//CruiseControl is open source software and is developed and maintained by a group of dedicated volunteers.  //CruiseControl is distributed under a BSD-style license. //http://cruisecontrol.sourceforge.net/ using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; namespace ThoughtWorks.CruiseControl.Core.Util {     /// <summary>     /// Class with handy stirng routines     /// </summary>     public class StringUtil     {         public static string IntegrationPropertyToString(object value)         {             string DEFAULT_DELIMITER = ",";             return IntegrationPropertyToString(value, DEFAULT_DELIMITER);         }         public static string IntegrationPropertyToString(object value, string delimiter)         {             if (value == null)                 return null;             if ((value is string) || (value is int) || (value is Enum))                 return value.ToString();             if (value is ArrayList)             {                 string[] tmp = (string[])((ArrayList)value).ToArray(typeof(string));                 if (tmp.Length <= 1)                     return string.Join(string.Empty, tmp);                 return string.Format("\"{0}\"", string.Join(delimiter, tmp));             }             throw new ArgumentException(                 string.Format("The IntegrationProperty type {0} is not supported yet", value.GetType()), "value");         }    } }