我可以在vb .net中使用关键字作为属性名吗? [英] can i use a keyword as a propertyname in vb .net?
本文介绍了我可以在vb .net中使用关键字作为属性名吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须将一个类序列化/反序列化为JSON字符串/然后返回.JSON Strinig必须包含错误"字符串(例如:{error:发生奇怪的东西",id:23,结果:"xxxxx"}),它指定出现的错误.
I have to serialize/deserialize a class into a JSON string/and return. The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.
我如何实现类似这样的类:
How can i implement a class like:
Public Class JsonResponse
Public result As JsonResult
Public error As String
Public id As Integer
End Class
如果我这样做,则错误"一词无效.
If i do this, the word 'error' is invalid.
谢谢
推荐答案
用方括号括起来
Public Class JsonResponse
Public result As JsonResult
Public [error] As String
Public id As Integer
End Class
HTH
这篇关于我可以在vb .net中使用关键字作为属性名吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文