ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

I'm posting a small utility class I wrote for files, in C#

(1/2) > >>

kyrathaba:
The attached zip file can be extracted and then the project can be run with Visual Studio (Express or higher editions).
The text file just lists the method signature for the six methods of the static class, and comments them.
As demonstrated in the project, use a "using" statement to reference my namespace.

Demonstrates:
(1) converting file size (number of bytes) to string description, e.g., "7.405 Kb"
(2) reading a file into an array of type byte
(3) writing string data to a filepath
(4) returning number of files in given directory matching a given pattern
(5) returning total size of those pattern-matched files, in bytes
(6) obtaining the directory of the currently executing assembly for a C# console application

See this link: https://www.donationcoder.com/forum/index.php?topic=38081

kyrathaba:
^ Fixed a couple typos in my previous post.

kyrathaba:
I'm posting a slightly modified version of the project that adds a demonstration of creating a nested subdirectory and writing a file to it. This version does everything the project in the OP does, plus this extra functionality. See attachment.

Deozaan:
Wouldn't it be easier to manage and update if you just posted a link to a gist?

kyrathaba:
Good idea. I'll look into it.

Navigation

[0] Message Index

[#] Next page

Go to full version