Я пытаюсь передать коллекцию объектов методу в c #.
Вот методы.
Сначала ожидается, что будет передано одно свойство.
/// <summary>
/// Adds an EXIF property to an image.
/// </summary>
/// <param name="inputPath">file path of original image</param>
/// <param name="outputPath">file path of modified image</param>
/// <param name="property"></param>
public static void AddExifData(string inputPath, string outputPath, ExifProperty property)
{
using (Image image = Image.FromFile(inputPath))
{
ExifWriter.AddExifData(image, property);
image.Save(outputPath);
}
}
Второй ожидает набор свойств. Это метод, который я тоже хочу передать.
/// <summary>
/// Adds a collection of EXIF properties to an image.
/// </summary>
/// <param name="inputPath">file path of original image</param>
/// <param name="outputPath">file path of modified image</param>
/// <param name="properties"></param>
public static void AddExifData(string inputPath, string outputPath, ExifPropertyCollection properties)
{
using (Image image = Image.FromFile(inputPath))
{
ExifWriter.AddExifData(image, properties);
image.Save(outputPath);
}
}
Чтобы передать данные как одно свойство, я использую этот код.
// Add folder date to exif tag
ExifProperty folderDate = new ExifProperty();
folderDate.Tag = ExifTag.DateTime;
folderDate.Value = lastPart.ToString();
ExifWriter.AddExifData(imagePath, outputPath, copyright);
Здесь я передаю только одно свойство методу. Как я могу отправить несколько элементов в метод, как это.
// add copyright tag
ExifProperty copyright = new ExifProperty();
copyright.Tag = ExifTag.Copyright;
copyright.Value = String.Format(
"Copyright (c){0} Lorem ipsum dolor sit amet. All rights reserved.",
DateTime.Now.Year);
// Add folder date to exif tag
ExifProperty folderDate = new ExifProperty();
folderDate.Tag = ExifTag.DateTime;
folderDate.Value = lastPart.ToString();
Тогда передать оба эти свойства?
ExifWriter.AddExifData(imagePath, outputPath, ??????????);
Спасибо