Inline Script Error Expected Class Delegate Enum Interface Or Struct
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta expected class delegate enum interface or struct void Discuss the workings and policies of this site About Us Learn
Expected Class Delegate Enum Interface Or Struct In Mvc
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us how to solve expected class delegate enum interface or struct 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
Cs1518 Expected Class Delegate Enum Interface Or Struct
you, helping each other. Join them; it only takes a minute: Sign up “Expected class, delegate, enum, interface or struct” error on public static string MyFunc(). What's an alternative to “string”? up vote 11 down vote favorite 3 I'm getting an error when I attempt to use the following static function. Error: Expected class, delegate, enum, interface, type or namespace definition or end-of-file expected or struct Function (and class): namespace MyNamespace { public class MyClass { // Some other static methods that use Classes, delegates, enums, interfaces, or structs public static string MyFunc(string myVar){ string myText = myVar; //Do some stuff with myText and myVar return myText; } } } This is causing the compiler to angrily (in red) underline the string part of public static string. So, I assume this means string is not a class, delegate, enum, interface, or struct. What can I use instead of string to return a string or string-like object? There doesn't appear to be a String (capital S) class in C#. Edit: Bracket mis-match with some commented code - the above code works correctly, my actual mis-matched code didn't. Thanks! c# compiler-errors static-methods share|improve this question edited May 14 '14 at 13:26 Irvin Dominin 22.9k64068 asked Jan 28 '11 at 2:14 Peach 75911222 add a comment| 2 Answers 2 active oldest votes up vote 21 down vote accepted You need to put the method definition into
here for a quick overview of the site Help Center Detailed answers to any questions you might
Identifier Expected C#
have Meta Discuss the workings and policies of this site About
C# Enum
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 http://stackoverflow.com/questions/4824194/expected-class-delegate-enum-interface-or-struct-error-on-public-static-str programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error: expected class,delegate,enum,interface or struct up vote 0 down vote favorite I get the following error on the code below: expected class,delegate,enum,interface or struct. This happens when hovering on GH_ObjectResponse, what am I doing wrong? public class SettingsComponentAttributes : GH_ComponentAttributes http://stackoverflow.com/questions/11769866/error-expected-class-delegate-enum-interface-or-struct { public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) {} } public override GH_ObjectResponse RespondToMouseDoubleClick( GH_Canvas sender, GH_CanvasMouseEvent e) { ((SettingsComponent)Owner).ShowSettingsGui(); return GH_ObjectResponse.Handled; } c# visual-studio-2010 syntax-error share|improve this question edited Jun 4 at 17:33 Uwe Keim 22.6k25100159 asked Aug 2 '12 at 1:32 Arthur Mamou-Mani 83832551 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted Your method is not declared inside the class... try this instead: public class SettingsComponentAttributes : GH_ComponentAttributes { public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) { } public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) { ((SettingsComponent)Owner).ShowSettingsGui(); return GH_ObjectResponse.Handled; } } share|improve this answer answered Aug 2 '12 at 1:34 Glen Hughes 2,466917 add a comment| up vote 1 down vote Watch your brackets. It should be: public class SettingsComponentAttributes : GH_ComponentAttributes { public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) {} public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) { ((SettingsComponent)Owner).ShowSettingsGui(); return GH_ObjectResponse.Handled; } } share|improve this answer answered Aug 2 '12 at 1:35 Major Productions LLC 3,774545104 add a comment| Yo
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a https://www.experts-exchange.com/questions/23896418/Error-in-C-expected-class-delegate-enum-interface-or-struct.html Question Ask for Help Receive Real-Time Help Create a Freelance https://docs.google.com/document/d/1451AULb4pnwA0iwEsZi7s5jt3CoVpR-PP1LLwIIVnKA/edit Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > Error in C#--expected class, delegate, expected class enum, interface, or struct Want to Advertise Here? Solved Error in C#--expected class, delegate, enum, interface, or struct Posted on 2008-11-11 C# 3 Verified Solutions 38 Comments 8,329 Views Last Modified: 2012-05-05 I am using Microsoft Visual C# to try to find isolate an error. It is highlighting "void" in the first expected class delegate line, and the following error comes up: Expected class, delegate, enum, interface, or struct What does that mean and how can I fix it? protected void status_SelectedIndexChanged(object sender, System.EventArgs e) { if (statusAns.SelectedValue == "status_guest") { RequiredFieldValidator4.enabled = true; } else { RequiredFieldValidator4.enabled = false; } } Status:*
If you are a guest user,
please tell us what school are you from:
meer ondersteund. Upgrade naar een ondersteunde browser.SluitenBestandBewerkenWeergevenExtraHelpToegankelijkheidFoutopsporingNieuwe wijzigingen weergevenToegankelijkheidAlleen weergevenOndersteuning voor schermlezer in- of uitschakelen