Home > expected class > error cs1518 expected class

Error Cs1518 Expected Class

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of expected class delegate enum interface or struct c# this site About Us Learn more about Stack Overflow the company Business Learn cs1518 error more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CS1518: Expected class, delegate, enum, interface, or struct up vote -1 down vote favorite I am trying to write a new XSLT package. The code that I am using is public virtual string CustomShowInventoryTable(String sProductID, String sVariantID) { StringBuilder results = new StringBuilder(""); if (AppLogic.AppConfigBool("ShowInventoryTable")) { results.Append(AppLogic.GetInventoryTable(ProductID, VariantID, true, ThisCustomer.SkinID, true, false)); } return results.ToString(); } The error I am getting is Compiler Error Message: CS1518: Expected class, delegate, enum, interface, or struct I have tried checking the ( and ) within the file but I still get this compiled error. c# xslt share|improve this question edited Feb 20 '14 at 15:00 helderdarocha 14.5k31535 asked Feb 20 '14 at 14:21 Jennifer Larsson 713 1 The compiler should tell you which line, and which column of that line, it's complaining about. Which line is that? (And in this case what's happening before that, since this message usually means your {} braces are not matched properly.) –keshlam Feb 20 '14 at 14:25 Its this linepublic virtual string CustomShowInventoryTable(String sProductID, String sVariantID) –Jennifer Larsson Feb 20 '14 at 14:27 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted I believe that you have a couple of typos in your code: It should be public virtual String, not string. Or maybe string sProductID, string sVariantID instead of String, depending on which language you're working with. AppLogic.GetInventoryTable(ProductID, VariantID - are those variables defined? The ones that your method receive have different names, sProductID and sVariantID... share|improve this answ

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, http://stackoverflow.com/questions/21910568/cs1518-expected-class-delegate-enum-interface-or-struct just like you, helping each other. Join them; it only takes a minute: Sign up Getting CS1518: Expected class, delegate, enum, interface, or struct error up vote 1 down vote favorite I'm new to C# and I'm trying to learn (I've been asking a few questions lately on it - my only programming knowledge is in http://stackoverflow.com/questions/12975155/getting-cs1518-expected-class-delegate-enum-interface-or-struct-error Python, PHP and Javascript). Anyway, I found some examples on the web for how to generate a picklist in C#, and I'm trying to use/modify them to fit my existing code. The results are coming up with an expected class error - but I'm creating a class! Here's my code: private void PeerReview() { MySqlConnection connection; string connStringName = "server=localhost;database=hourtracking;uid=username;password=password"; connection = new MySqlConnection(connStringName); cmd.CommandText = "select name from peer_review_info where active_status=1"; cmd.Connection = connection; connection.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { ListItem item = new ListItem(); item.Text = sdr["peerrevid"].ToString(); item.Value = sdr["peerrevid"].ToString(); item.Selected = Convert.ToBoolean(sdr["IsSelected"]); chkPeerRev.Items.Add(item); } } connection.Close(); } } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.PeerReview(); } } c# asp.net mysql class share|improve this question asked Oct 19 '12 at 13:19 Andrew Alexander 2,993145199 Wait, or am I just using a method of a class that does not exist? –Andrew Alexander Oct 19 '12 at 13:20 2 Where do you get thi

SQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums https://social.msdn.microsoft.com/Forums/en-US/faa1c046-38a8-4d76-a2b5-bac06d790afe/cs1518-expected-class-delegate-enum-interface-or-struct?forum=csharplanguage Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. https://bytes.com/topic/c-sharp/answers/669488-trying-declare-extern-function Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: CS1518: Expected class, delegate, enum, interface, or expected class struct Archived Forums V > Visual C# Language Question 0 Sign in to vote I am hoping for some help. I put together this conference manager program but I cant seem to find my error with the class reference. please help. Here is the program. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace error cs1518 expected ConLink { class Program { private const int DELAY = 30; private const int DELAYLONG = 30 * DELAY; static void Main(string[] args) { try { if (Login()) { Console.WriteLine(); SlowString( "Perhaps a game of Global Thermonuclear War?"); Console.Write(">>"); if (Console.ReadLine() != String.Empty) { SlowString("Loading HotelReg 34.234.22"); Console.WriteLine(); Wait(); bool blnOK; do { blnOK = RegGuest(); } while (blnOK); } } } catch (Exception) { Console.WriteLine("Unexpected error!"); } finally { Console.WriteLine(); SlowString("Goodbye."); } } private static void wait() { Thread.Sleep(DELAYLONG); } // Note three overloaded versions of the same procedure. private static void SlowString(String Data) { SlowString(Data, true, DELAY); } private static bool Login() { SlowString( "Attempting Remote Connection. Please wait . . ."); Wait(); SlowString("Connection Successful"); SlowString("HAL System 432.38851.014 is online."); SlowString(String.Format("Today is {0:D}", DateTime.Today)); Wait(); Console.WriteLine(); SlowString("User id: >", false); String strUserId = Console.ReadLine(); if (String.IsNullOrEmpty(strUserId)) return false; else { SlowString("Password: >", false); Console.ReadLine(); // Of course, you might really validate in here... SlowString(String.Format( "Welcome back {0}. I hope you are well.", strUserId)); Sl

your question and get tips & solutions from a community of 418,509 IT Pros & Developers. It's quick & easy. Trying to declare an extern function P: n/a =?Utf-8?B?UmljaGFyZEBub3NwYW0ubm9zcGFt?= I'm trying to declare CreateFile as an extern from the dll like so: .... using System.Runtime.InteropServices; [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError=true)] internal static extern IntPtr CreateFile( String filename, UInt32 desiredAccess, UInt32 shareMode, IntPtr attributes, // Really, this is the SECURITY_ATTRIBUTES pointer UInt32 creationDisposition, UInt32 flagsAndAttributes, IntPtr templateFile); namespace CsharpPipes { .... I get an error on the "IntPtr" that says: error CS1518: Expected class, delegate, enum, interface, or struct with F1 help text of: A declaration was found that is not supported in a namespace. Inside a namespace, the compiler accepts only classes, structs, enums, interfaces, namespaces, and delegates. I assumed my declaration was outside a namespace(?) What's the proper syntax to declare CreateFile? Thanks in advance. Richard Jun 27 '07 #1 Post Reply Share this Question 4 Replies P: n/a Jon Skeet [C# MVP] On Jun 27, 3:46 pm, Rich...@nospam.nospam wrote: I assumed my declaration was outside a namespace(?) What's the proper syntax to declare CreateFile? Your assumption is incorrect - your declaration should be within a class, like any other method declaration. Jon Jun 27 '07 #2 P: n/a Tom Spink Ri*****@nospam.nospam wrote: I'm trying to declare CreateFile as an extern from the dll like so: ... using System.Runtime.InteropServices; [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError=true)] internal static extern IntPtr CreateFile( String filename, UInt32 desiredAccess, UInt32 shareMode, IntPtr attributes, // Really, this is the SECURITY_ATTRIBUTES pointer UInt32 creationDisposition, UInt32 flagsAndAttributes, IntPtr templateFile); namespace CsharpPipes { ... I get an error on the "IntPtr" that says: error CS1518: Expected class, delegate, enum, interface, or str

 

Related content

c# error 2 expected class delegate enum interface or struct

C Error Expected Class Delegate Enum Interface Or Struct table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Delegate Enum Interface Or Struct Void a li li a href How To Solve Expected Class Delegate Enum Interface Or Struct a li li a href Error Type Or Namespace Definition Or End-of-file Expected a li ul td tr tbody table p here for relatedl a quick overview of the site Help error expected class delegate enum interface or struct Center Detailed answers to any questions you might have Meta expected class delegate enum

c# error cs1518 expected class delegate enum interface or struct

C Error Cs Expected Class Delegate Enum Interface Or Struct table id toc tbody tr td div id toctitle Contents div ul li a href How To Solve Expected Class Delegate Enum Interface Or Struct a li li a href Error Type Or Namespace Definition Or End Of File Expected a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you relatedl might have Meta Discuss the workings and policies of error expected class delegate enum interface or struct c this site About Us Learn more about

compiler error message cs1518

Compiler Error Message Cs table id toc tbody tr td div id toctitle Contents div ul li a href C Cs a li li a href Expected Class Delegate Enum Interface Or Struct C a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to relatedl any questions you might have Meta Discuss the workings p h id C Cs p and policies of this site About Us Learn more about Stack Overflow error cs expected class delegate enum interface or struct the company Business Learn more about hiring developers

error 1 expected class delegate enum interface or struct

Error Expected Class Delegate Enum Interface Or Struct table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Delegate Enum Interface Or Struct In Mvc a li li a href Expected Class Delegate Enum Interface Or Struct cs a li li a href How To Solve Expected Class Delegate Enum Interface Or Struct a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn relatedl more

error 2 expected class delegate enum interface or struct

Error Expected Class Delegate Enum Interface Or Struct table id toc tbody tr td div id toctitle Contents div ul li a href List Expected Class Delegate Enum Interface Or Struct a li li a href Expected Class Delegate Enum Interface Or Struct cs a li li a href Type Or Namespace Definition Or End-of-file Expected a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site relatedl About Us Learn more about Stack Overflow the

error conversion to inaccessible base class is not allowed

Error Conversion To Inaccessible Base Class Is Not Allowed table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Name Before Token Inheritance a li li a href Can Protected Class Be Inherited a li li a href C Public Inheritance Private Members a li li a href C Public Vs Private Vs Protected a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any relatedl questions you might have Meta Discuss the workings and expected class member or base class name

error cs1518 expected class delegate enum interface or struct

Error Cs Expected Class Delegate Enum Interface Or Struct table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Delegate Enum Interface Or Struct Void a li li a href Expected Class Delegate Enum Interface Or Struct In Mvc a li li a href Error Type Or Namespace Definition Or End Of File Expected a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings relatedl and policies of this site About Us Learn

error expected either a definition for a tag name

Error Expected Either A Definition For A Tag Name table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Name C a li li a href Expected Class Name Before Token Qt a li li a href Base Class Has Incomplete Type a li li a href Undefined Reference To Vtable a li ul td tr tbody table p p p basic information about a student and their test relatedl grades I need to have the user determine invalid use of incomplete type c the number of structures to be defined I know

expected class delegate enum interface or struct error

Expected Class Delegate Enum Interface Or Struct Error table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Delegate Enum Interface Or Struct Void a li li a href How To Solve Expected Class Delegate Enum Interface Or Struct a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the relatedl workings and policies of this site About Us Learn more expected class delegate enum interface or struct in mvc about Stack Overflow the company

inline script error expected class delegate enum interface or struct

Inline Script Error Expected Class Delegate Enum Interface Or Struct table id toc tbody tr td div id toctitle Contents div ul li a href Expected Class Delegate Enum Interface Or Struct In Mvc a li li a href Cs Expected Class Delegate Enum Interface Or Struct a li li a href Identifier Expected C a li li a href C Enum a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed relatedl answers to any questions you might have Meta expected class delegate enum interface or struct void Discuss the