zip file open and reading in C#

hi - I'm using VS2010 and .net 4.0 and for program reasons can't upgrade to 4.5. I'm trying to open and read the contents of a zip file so that I can create a data set internal to my program (ie I have no need to create the rest of the zip operation of placing unzipped files somewhere.) I've looked at the Microsoft example code in their Package class that deals with zips and there is reference to an attribute that's not explained. specifically, in the foreach statement to get relationships, the line reads"\
"foreach ( PackageRelationship relationship in documentPart.GetRelationshipByType(ResourceRelationshipType))
the ResourceRelationshipType is undefined if I compile as is. the method is calling for a string, but I don't know where to find the ResourceRelationshipTypes list.
any suggestions?
thanks,
jdcoburnAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jaime OlivaresConnect With a Mentor Software ArchitectCommented:
0
 
Miguel OzSoftware EngineerCommented:
Please consider using dotnetzip library, for you case:
using (ZipFile zip = ZipFile.Read(ExistingZipFile))
{
  foreach (ZipEntry e in zip)
     System.Console.WriteLine(e.FileName); //You could add it to a list, etc.
}

Open in new window

Note: The code sample is a simplified version of Nicholas Carey's answer.
0
 
käµfm³d 👽Commented:
Can you provide a link to the page that has the code example?
0
 
jdcoburnAuthor Commented:
it worked fine, but I had to modify several methods to get it to work.
0
All Courses

From novice to tech pro — start learning today.