为什么我在此代码上得到CS1056意外字符'' [英] Why do I get an CS1056 Unexpected character '' on this code
本文介绍了为什么我在此代码上得到CS1056意外字符''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了这个意外的字符''错误,我不明白为什么.
I'm getting this unexpected character '' error and I don't understand why.
var list = new List<MyModel>();
list.Add(new MyModel() {
variable1 = 942,
variable2 = 2001,
variable3 = "my text",
variable4 = 123
}); // CS1056 Unexpected character '' on this line
推荐答案
从错误的内容以及复制/粘贴后我从Online编译器获得的实际错误代码,您在此行的代码包含不可见的字符但是编译器正在尝试解释.只需尝试擦除从您的右括号向3号开始的每个字符,然后再次按Enter,它应该可以工作了(确实对我有用)
From what the error says and the actual error code I got from an Online compiler after copy/pasting, Your code on this line contains a character that is not visible but that the compiler is trying to interpret. Simply try erase every character starting at your closing bracket towards your number 3 and press Enter again It should be working (it did work for me)
这篇关于为什么我在此代码上得到CS1056意外字符''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文