// Snippet Start
public static void Run(string fileName)
{
// DataSet is the object used to interact with the data file.
// StreamFactory creates Dataset with pool of binary readers to
// perform device lookup using file on disk.
DataSet dataSet = StreamFactory.Create(fileName, false);
// Provides access to device detection functions.
Provider provider = new Provider(dataSet);
// Used to store and access detection results.
Match match;
// Device id string of an iPhone mobile device.
string mobileDeviceId = "12280-48866-24305-18092";
// Device id string of Firefox Web browser version 41 on desktop.
string desktopDeviceId = "15364-21460-53251-18092";
// Device id string of a MediaHub device.
string mediaHubDeviceId = "41231-46303-24154-18092";
Console.WriteLine("Starting Match For Device Id Example.");
//Carries out a match for a mobile device id.
match = provider.MatchForDeviceId(mobileDeviceId);
Console.WriteLine("\nMobile Device Id: " + mobileDeviceId);
Console.WriteLine(" IsMobile: " + match["IsMobile"]);
// Carries out a match for a desktop device id.
match = provider.MatchForDeviceId(desktopDeviceId);
Console.WriteLine("\nDesktop Device Id: " + desktopDeviceId);
Console.WriteLine(" IsMobile: " + match["IsMobile"]);
// Carries out a match for a MediaHub device id.
match = provider.MatchForDeviceId(mediaHubDeviceId);
Console.WriteLine("\nMediaHub Device Id: " + mediaHubDeviceId);
Console.WriteLine(" IsMobile: " + match["IsMobile"]);
// Finally close the dataset, releasing resources and file locks.
dataSet.Dispose();
}