我想知道是否可以在引号内发表评论。
"pizza,dogs,hype"
是否可以评论"魔术,"所以输出会显示为:
public class PathButton : Button
{
public static DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(Geometry), typeof(PathButton), new FrameworkPropertyMetadata(new PropertyChangedCallback(Data_Changed)));
public Geometry Data
{
get { return (Geometry)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
private static void Data_Changed(DependencyObject o, DependencyPropertyChangedEventArgs args)
{
PathButton thisClass = (PathButton)o;
thisClass.SetData();
}
private void SetData()
{
Path path = new Path();
path.Data = Data;
path.Stroke = this.Foreground;
path.StrokeThickness = 1;
this.Content = path;
}
}
答案 0 :(得分:4)
我建议将每个单词放在一个单独的行上:
"pizza,"
"magic,"
"dogs,"
"hype";
这使您可以更轻松地评论单词:
"pizza,"
/* "magic," */
"dogs,"
"hype";
编译器将在用空格分隔时连接字符串文字(并且换行符是空格)。
答案 1 :(得分:1)
不,但你可以改写它:
"pizza,"/*magic,*/"dogs,hype"