Development – Leet 4 Life

Software Development Code Samples and More

Skip to: Content | Sidebar | Footer

Tag: Convert

Displaying TIFF Images in ASP.NET

3 October, 2012 | ASP.NET, C#. NET | By: Michael Adams

I needed to display TIFF images that were stored in the database. Unfortunately it is not as simple as just setting the MIME Type and writing out the binary. The reason for this is because the TIFF image type is only supported in IE currently. So I asked Google and the overwhelming response I saw was to convert the TIFF into another image type and then write out the binary to the response stream. Here is my take on the solution: Written in C# (the image is sent via a Generic Handler hence the “context.Response”): It should be noted that [Read More…]

Convert One Entity Object to A Similar Entity Object

30 April, 2012 | C#. NET, Entity Framework | By: Michael Merrell

Not too long ago I came across the need to be able to convert one entity object to another similar entity object for use in display purposes and mapping. Even though these two objects were nearly identical they had over two hundred fields in them so writing a method to simply set properties equal to each other would have created a huge method and a higher chance of error. Using reflection I created a nice little thinned down method that will take in your source object, the output object type, and a reference to the instantiated output object. Then using [Read More…]