C# Error Cs1012 Too Many Characters In Character Literal
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and error 1 too many characters in character literal c# policies of this site About Us Learn more about Stack Overflow the too many characters in character literal c# string company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags too many characters in character literal c# split 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
Too Many Characters In Character Literal Aspx
takes a minute: Sign up Why I'm getting CS1012: “Too many characters in character literal” and CS0019? up vote 15 down vote favorite When trying to upload something to Imgur, I have to put an Authorization in. I do it with WebRequest.Headers but it gives me three errors. 2 times CS1012 error Too many characters in character literal and 1 time too many characters in character literal java CS0019 error: Operator '+' cannot be applied to operands of type 'char' and 'method group' This is the code: webRequest.Headers['Authorization'] = 'Bearer ' + GetToken; What have I done wrong, how can I fix it, and how does it work? This is uploading with Imgur, I don't know if the 'GetToken' thing is right but it's to get the AccessToken, which should work correctly if I'm right. c# imgur share|improve this question edited Dec 15 '13 at 21:55 Alexei Levenkov 70.8k55398 asked Dec 15 '13 at 21:45 Stepepper 3581616 add a comment| 1 Answer 1 active oldest votes up vote 47 down vote accepted You're trying to use single quotes for string literals - that's invalid in C#. Single quotes are for character literals (char). You need double quotes for string literals. You also need parentheses for a method call: webRequest.Headers["Authorization"] = "Bearer " + GetToken(); (Note that this has nothing to do with imgur or WebRequest - it's just normal C#.) Links to MSDN explanations with samples: CS1012 - "Too many characters in character literal" CS0019 - "Operator 'ope
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation too many characters in character literal javascript APIs and reference Dev centers Retired content Samples We’re sorry. The content
Too Many Characters In Character Literal Android
you requested has been removed. You’ll be auto redirected in 1 second. MSDN Library MSDN Library MSDN Library
Too Many Characters In Character Literal Html
MSDN Library Design Tools Development Tools and Languages Mobile and Embedded Development .NET Development Office development Online Services Open Specifications patterns & practices Servers and Enterprise Development Speech Technologies Web http://stackoverflow.com/questions/20600191/why-im-getting-cs1012-too-many-characters-in-character-literal-and-cs0019 Development Windows Desktop App Development TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Compiler Error CS1012 Other Versions Visual Studio 2008 Visual Studio 2005 Visual Studio .NET 2003 Too many characters in character literalAn attempt was made to https://msdn.microsoft.com/en-us/library/185szk2f.aspx initialize a char constant with more than one character.CS1012 can also occur when doing data binding. For example the following line will give an error:<%# DataBinder.Eval(Container.DataItem, 'doctitle') %>Try the following line instead:<%# DataBinder.Eval(Container.DataItem, "doctitle") %>The following sample generates CS1012: Copy // CS1012.cs class Sample { static void Main() { char a = 'xx'; // CS1012 char a2 = 'x'; // OK System.Console.WriteLine(a2); } } Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? Yes No Additional feedback? 1500 characters remaining Submit Skip this Thank you! We appreciate your feedback. Dev centers Windows Office Visual Studio Microsoft Azure More... Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter Privacy & cookies Terms of use Trademarks © 2016 Microsoft © 2016 Microsoft
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question http://www.codeproject.com/Questions/716466/Too-many-characters-in-character-literal View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / https://www.experts-exchange.com/questions/21749576/CS1012-Too-many-characters-in-character-literal-when-Calling-a-javascript-function.html Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> too many System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & too many characters The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ Too many characters in character literal Rate this: Please Sign up or sign in to vote. See more: C# ASP.NET CSS SQL Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1012: Too many characters in character literal Source Error: Line 212:
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance 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 > CS1012: Too many characters in character literal when Calling a javascript function Want to Advertise Here? Solved CS1012: Too many characters in character literal when Calling a javascript function Posted on 2006-02-23 .NET Programming 1 Verified Solution 2 Comments 14,346 Views Last Modified: 2012-06-21 I've been getting this error message, "CS1012: Too many characters in character literal". I want to execute a javascript function when an asp button is clicked. Here's the l.ine of code that's giving me the problem...