[Mono-dev] Fixes for System.Net.Mail

Miguel de Icaza miguel at ximian.com
Mon Dec 4 13:45:05 EST 2006


> Question: is the SWF good enough to be put into System.dll and be
> invoked from System.Web, SWF and for this mail class?

If we are going down the path of mapping file names to mime types, we
should instead use a switch statement that will consume no memory for
the large majority of applications, something similar to what tokenizers

	char c = filename_extension [0];

	switch (c){
		case 'm':
			if (filename_extension == "mp3")
				return ...;

> Or should we add an icall so we implement this stuff using the operating
> system API or a C implementation? What is quite clear to me is that we
> should not use an hashtable with all the entries which is kept in memory
> all the time.

This is highly operating system *and* desktop specific, and it is
usually a slow process.

We would need to determine if we want a mime-type based on the filename,
or a mime-type based on the actual contents of the file.   The latter is
more correct, but has some undesirable effects like touching the file
system (which could in some cases take forever, or block the
application, for example over /afs and other file systems) and also
might slow down applications a lot.

If we are going for mime-type-based-on-filename-only, then I would use a
switch statement instead of the Hashtable.

More information about the Mono-devel-list mailing list