Re: Generic filehandler method
- From: "Ron" <rs_herhuth@xxxxxxxxx>
- Date: Thu, 15 May 2008 11:32:09 -0400
The subtlety is that using this method the filetype is specified by the programmer that is coding the caller operation, and I would imagine there is some way to open a file as a type...is that not the case?
Thanks,
Ron
<mrshrinkray@xxxxxxxxxxxxxx> wrote in message news:46c02ac3-6e52-4d91-ad4b-02477383d635@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 15 May, 16:15, "Peter Duniho" <NpOeStPe...@xxxxxxxxxxxxxxxx> wrote:On Thu, 15 May 2008 06:23:27 -0700, Ron <rs_herh...@xxxxxxxxx> wrote:
> I am trying to build a generic static method that will return a
> specified type from a method. My problem is that I need to return say
> an image from the method...and I'm having trouble understanding how to
> do this.
It is not clear why you want this method to be generic. Whatever type you
supply for T, it _must_ be valid for the type of data you expect to
extract from the file. That means that in advance, you need to know what
type you expect. That means that there's no need for a generic method to
read the file. Just use existing type-specific i/o mechanisms.
Pete
You would need to create your own wrapper classes around each type of
file (ImageLoader,TextFileLoader,BinaryFileLoad) which as pete said
you might as well just make a class with 4 methods to handle each one,
Image and FileStream have nothing in common besides Object so there's
no way of calling a Load method generically
.
- Follow-Ups:
- Re: Generic filehandler method
- From: Paul E Collins
- Re: Generic filehandler method
- From: mrshrinkray@xxxxxxxxxxxxxx
- Re: Generic filehandler method
- References:
- Generic filehandler method
- From: Ron
- Re: Generic filehandler method
- From: Peter Duniho
- Re: Generic filehandler method
- From: mrshrinkray@xxxxxxxxxxxxxx
- Generic filehandler method
- Prev by Date: Re: Time Part Names
- Next by Date: Re: Open file without knowing the extension
- Previous by thread: Re: Generic filehandler method
- Next by thread: Re: Generic filehandler method
- Index(es):
Relevant Pages
|