Solved

Expected ;

Posted on 2006-07-19
5
238 Views
Last Modified: 2010-04-16
Why am I getting expected ; when I have one?

        try
        {
            objReader = New StreamReader("C:\\inetpub\\wwwroot\\search\\SearchRestults.aspx");
            strContents = objReader.ReadToEnd();
            objReader.Close();
            return new MyVirtualFile("Search/", strContents);
        }
...
0
Comment
Question by:dba123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 4

Expert Comment

by:DarkXiphoid
ID: 17137722
Hmm, the bit of code seems fine, no missing ;'s. Do you have a catch or finally?  you must always use either "catch" of "finally" after a try, else it won't compile.

0
 
LVL 1

Author Comment

by:dba123
ID: 17137867
yea, the ... means I have the rest there

    public override System.Web.Hosting.VirtualFile GetFile(string virtualPath)
    {
        String strContents;
        StreamReader objReader;  
        try
        {
            objReader = New StreamReader("C:\\inetpub\\wwwroot\\search\\SearchRestults.aspx");
            strContents = objReader.ReadToEnd();
            objReader.Close();
            return new MyVirtualFile("Search/", strContents);
        }
        catch (Exception Ex)
        {
            return Ex.Message;
        }
    }
0
 
LVL 1

Author Comment

by:dba123
ID: 17137915
well I don't think it recognizes the method StreamReader.  I get that little helper underscore thingy in VS 2005 asking me if I want to create a message stub for StreamReader.  Usually this means the complier doesn't recognize it.  I have using System.IO at the top so I don't know what the deal is.
0
 
LVL 6

Accepted Solution

by:
e1v earned 500 total points
ID: 17138209
It's because uou are using "New" with a capital N !

Use "new" instead
0
 
LVL 1

Author Comment

by:dba123
ID: 17138217
still getting used to C#, thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question