# DotNet Example: Image metadata class

Description

When writing an Xbasic function that uses the .NET Framework, you always have the option of writing or using a custom .NET class that gives you a simplified interface compared to using the .NET Framework classes directly. This example demonstrates extracting EXIF information from an image using the Exifacto .NET library.

dim sv as dotnet::services
dim assy as dotnet::assemblyreference

'edit the path to the DLL in the next line
assy.FileName = "C:\path\to\Exifacto.dll"
sv.RegisterAssembly("exif",assy)

'edit the path to the image in the next line
filename="C:\full\path\to\image\file"

ex = new exif::Exifacto::exifdata(filename)

CameraMake=ex.CameraMake
CameraModel=ex.CameraModel
DateTimeOriginal=ex.DateTimeOriginal
ImageDescription=ex.ImageDescription
Orientation=ex.Orientation.value__
ExposureProgram=ex.ExposureProgram.value__
Software=ex.Software

'show selected properties
exif_data = filename + \
crlf()+"Camera: "+CameraMake+" "+CameraModel+" taken "+DateTimeOriginal+ \
showvar(ex) 'show all properties