[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Expected ;

Posted on 2006-07-19
5
Medium Priority
?
245 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 2000 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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 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