/// <summary>/// File Type Enum - The extensions that our application/// support to work.. check at the time of work with the
/// file.. e.g. read the file and save to database etc.
/// </summary>
enum FileTypes
{
BMP ,
JPG ,
JPEG,
GIF,
TIFF
}
string fileExtension = Path.GetExtension(filePath).ToUpper();
if (Enum.IsDefined(typeof(FileTypes),fileExtension.Trim('.')))
{
//convert string to enum
FileTypes c = (FileTypes) Enum.Parse(typeof(FileTypes), "MOV", true);
}
No comments :
Post a Comment