我有一个字符串,我试图将双引号替换为" space"所以我试过了:
NAME=t1["NAME"].ToString().Replace('"'," ")
但这似乎无效我得到以下错误:
无法将字符串转换为char
string.Replace(char,char)的最佳重载方法匹配有一些 无效的论点。
答案 0 :(得分:3)
尝试
ImageInfo newImageiInfo=new ImageInfo();
newImageiInfo.setSize("500x500");
newImageiInfo.setUnits(ResolutionType.PixelsPerInchResolution);
newImageiInfo.setColorspace(ColorspaceType.RGBColorspace);
newImageiInfo.setDepth(8);
MagickImage destImage = new MagickImage();
destImage.allocateImage(newImageiInfo);
destImage.setYResolution(480);
destImage.setXResolution(640);
destImage.setBorderColor(PixelPacket.queryColorDatabase("red"));
DrawInfo aInfo = new DrawInfo(newImageiInfo);
aInfo.setFill(PixelPacket.queryColorDatabase("yellow"));
aInfo.setUnderColor(PixelPacket.queryColorDatabase("red"));
aInfo.setOpacity(100);
aInfo.setPointsize(36);
aInfo.setFont("Arial");
aInfo.setGeometry("+50+50");
aInfo.setText("Test");
destImage.annotateImage(aInfo);
destImage.setFileName("file.png");
destImage.writeImage(newImageiInfo);
两个参数都应为NAME=t1["NAME"].ToString().Replace('"', ' ')
https://msdn.microsoft.com/en-us/library/czx8s9ts(v=vs.110).aspx