working on it ...

Filters

Explore Public Snippets

Sort by

Found 1 snippet matching: proeprties

    public by troy  384  1  6  1

    What is the size of this file?

    Tells me the size of the given file using the basic properties of UWP StorageFile.
    public static async Task<ulong> GetFileSize(this string filename)
    {
    	StorageFile file = await GetFile(filename);
    	if (file == null)
    		return 0;
    	try
    	{
    		BasicProperties fileSize = await file.GetBasicPropertiesAsync();
    		return fileSize.Size;
    	}
    	catch (Exception e)
    	{
    		s_log.ErrorFormat("Cannot read file {0} due to {1}", filename, e.Message);
    		return 0;
    	}
    }						

    List Complete ( 1 snippet total )

    Cannot find what you were looking for?
    Ask the Snip2Code Community

    • Public Snippets
    • Channels Snippets