問(wèn)題描述
我正在嘗試使用 vs 2012 中過(guò)去的特殊功能,以便為我的 Json 數(shù)據(jù)生成 c# 類.我從 Nuget 的 NewtonSoft 下載了 Json.New,然后添加了一個(gè)新的 .cs 類,將我的 json 數(shù)據(jù)復(fù)制到剪貼板,但是當(dāng)我轉(zhuǎn)到 Edit-> Paste Special --> 我只能看到:Paste XML As Classes only the PasteJson 作為類功能未顯示.有什么建議?提前謝謝你
I am trying to use the past special feature in vs 2012 in order to generate c# class for my Json data. I downloaded the Json.New from NewtonSoft from Nuget and then added a new .cs class the copied my json data to clipboard but when I go to Edit-> Paste Special --> I can only see: Paste XML As Classes only the Paste Json as Classes feature is not showing. Any Suggestions? Thanks you in advance
這是我得到的,請(qǐng)注意我已經(jīng)安裝了 Newtonsoft.Json:
This is what I am getting and please note that I have installed Newtonsoft.Json already:
(來(lái)源:indevcogroup.com)
推薦答案
我創(chuàng)建了一個(gè)新項(xiàng)目,安裝了 Newtonsoft.Json 并添加了一個(gè)類.
I created a new project, installed Newtonsoft.Json and added a class.
如果您打開了類文件,請(qǐng)復(fù)制您的 Json 數(shù)據(jù)并選擇編輯 -> 選擇性粘貼,您將看到兩個(gè)選項(xiàng):
If you have your class file open, copy your Json data and choose Edit -> Paste Special you will see both the options:
如果您打開了其他類型的文件(例如 app.config),您只會(huì)看到將 JSON 粘貼為類"(并且它是灰色的)
If you have some other kind of file open (e.g. app.config), you only see "Paste JSON as As Classes" (and it's greyed out)
不過(guò),它看起來(lái)確實(shí)有點(diǎn)不穩(wěn)定 - 有時(shí)我必須重新復(fù)制數(shù)據(jù)才能顯示出來(lái).
It does seem a bit flaky though - sometimes I had to recopy the data before it would show up.
嘗試 a) 重新復(fù)制您的數(shù)據(jù) b) 玩弄您打開的窗口 c) 重新安裝擴(kuò)展程序
Try a) recopying your data b) playing around with what windows you've got open c) reinstalling the extension
這篇關(guān)于如何顯示“粘貼 Json 類"在 Visual Studio 2012 中單擊選擇性粘貼時(shí)?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!