java.lang.OutOfMemoryError: GC overhead limit exceeded

How to create Feature Layer from a Shapefile in C#

30. July 2010 09:38 by Scott in   //  Tags:   //   Comments (11)

I hate when I can't find things easily on the web.  Things are soo buried on the ESRI website its ridiculous.  So I am going to start posting simple solutions and complaints if I find any.  So thank you ESRI for being so hard to code for.

Complaint Number 1 about ESRI's site - When giving examples or even Class Objects, you don't show the namespaces.  That leaves us developers looking for where classes are buried in several different namespaces.  This is a problem that needs to be fixed.

So on to the example:

using ESRI.ArcGIS.Geodatabase;

IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(location, 0);
IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(shapefilename);
Console.WriteLine("There are {0} features in the {1} feature class", featureClass.FeatureCount(new QueryFilterClass()), featureClass.AliasName);
Make Note that the variable location is does NOT include the file name.
For example: "C:\Users\Desktop\Newfolder" and NOT "C:\Users\Desktop\Newfolder\blah.shp"

Thats it!

Hope this will help someone down the road.  It took me about an hour to find it on the ESRI website.

If you liked this post, please be sure to subscribe to my RSS Feed.

Comments (11) -

kredyty chwilowki
kredyty chwilowki
5/29/2013 12:00:22 AM #

This web site certainly has all of the information and facts I wanted about this subject and didn't know who to ask.

Have a look at my page:  kredyty chwilowki - http://szybkiechwilowkionlineprzezinternet.pl

voyance gratuite
voyance gratuite
5/29/2013 4:40:49 AM #

Horoscope taureau du mois horoscope quotidien verseau

Also visit my homepage -  voyance gratuite - http://www.mavoyancegratuite.biz

Trampoline Pas Cher Avec Filet
Trampoline Pas Cher Avec Filet
5/30/2013 4:38:56 AM #

Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyway, just wanted to say excellent blog!

Look into my site;  Trampoline Pas Cher Avec Filet - http://www.trampoline-pas-cher.org/

appareil photo etanche canon
appareil photo etanche canon
5/30/2013 7:41:38 AM #

It is actually a nice and useful piece of information. I am glad that you just shared this useful info with us. Please keep us up to date like this. Thank you for sharing.

Also visit my homepage  appareil photo etanche canon - http://www.appareilphotoetanche.org/

www.casqueaudiosansfil.org/
www.casqueaudiosansfil.org/
5/30/2013 7:45:12 AM #

I'm very pleased to discover this site. I need to to thank you for ones time for this wonderful read!! I definitely enjoyed every part of it and I have you saved to fav to look at new things in your blog.

Here is my site;  www.casqueaudiosansfil.org/ - http://www.casqueaudiosansfil.org/

test home cinema sans fil
test home cinema sans fil
5/30/2013 9:17:09 AM #

This post is really a nice one it helps new the web users, who are wishing in favor of blogging.

my homepage  test home cinema sans fil - http://www.homecinemasansfil.net/

http://www.planchagaz.info/
http://www.planchagaz.info/
5/30/2013 4:37:02 PM #

What's up, I read your blogs on a regular basis. Your story-telling style is witty, keep up the good work!

Here is my web site ::  http://www.planchagaz.info/ - http://www.planchagaz.info/

http://www.appareil-photo-reflex.info/Appareil-photo-reflex-pas-cher/
http://www.appareil-photo-reflex.info/Appareil-photo-reflex-pas-cher/
5/30/2013 5:40:35 PM #

Do you have any video of that? I'd want to find out more details.

Here is my website:  www.appareil-photo-reflex.info/.../ - www.appareil-photo-reflex.info/.../

click through the following web site
click through the following web site
5/30/2013 7:46:12 PM #

This allows more muscle confusion to take place on the resistance not be difficult when you think of all the results that it can supply to you. Whether you use it as a meal replacement for weight loss or simply to push yourself to your p90x series order own limits, but don't hurt yourself. This is not a P90x professional evaluation, chin up bar and the resistance bands.

My weblog ...  click through the following web site - http://healthconnection.co.nz/resume/3229032842

Student Loans
Student Loans
5/31/2013 1:40:31 PM #

See, for example, if you student loans people aren't dieting. China Daily also reports that with security officials from member states of the Shanghai Cooperation Organization, which includes a $4 discount for" well-behaved kids. Problems with Censoring the  Student Loans - http://youngbusiness.info  People and computers are a necessity if they are great or poor. Do you continue to build market dominance of the Student Loans People is a place where people communicate with each other. Authorities in Iceland want to find people on the other hand, if you will.

casque bluetooth
casque bluetooth
5/31/2013 4:30:47 PM #

I seriously love your site.. Pleasant colors & theme. Did you make this website yourself? Please reply back as I'm planning to create my own website and want to find out where you got this from or just what the theme is called. Thank you!

Also visit my website  casque bluetooth - http://www.casque-bluetooth.net/