在VB.NET中,我们假设我有以下结构:
Public Structure Product
Public ItemNo As Int32
Public Description As String
Public Cost As Decimal
End Structure
Run Code Online (Sandbox Code Playgroud)
......以及产品的通用清单:
Dim ProductsList As New List(Of Product)
Dim product1 As New Product
With product1
.ItemNo = 100
.Description = "Standard Widget"
.Cost = 10D
End With
ProductsList.Add(product1)
Dim product2 As New Product
With product2
.ItemNo = 101
.Description = "Standard Cog"
.Cost = 10.95D
End With
ProductsList.Add(product2)
Dim product3 As New Product
With product3
.ItemNo = 101
.Description = "Industrial Strenght Sprocket" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Sublime Text 2在Windows 7 64位下使用Scala 2.9.1编辑和运行Scala脚本.我创建了以下scala.submline-build文件,尝试跟踪从命令行输入以下内容时发生的情况:
C:\work\Scala>scala ScalaGreetings.scala
Greetings from Scala...
C:\work\Scala>
Run Code Online (Sandbox Code Playgroud)
scala.sublime-build的内容如下:
{
"cmd": ["C:\\scala-2.9.1.final\\bin\\scala.bat $File"]
}
Run Code Online (Sandbox Code Playgroud)
使用Sublime Text选项卡中加载的简单Scala脚本,按F7键会导致Scala解释器被加载并运行,但脚本未按预期执行."构建"窗口中显示以下内容:
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_01).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
Run Code Online (Sandbox Code Playgroud)
考虑到这一点,我将非常感谢您对以下问题的帮助和反馈;
1.)我可以在Sublime Text 2中执行Scala脚本,并在成功解释脚本后将其输出显示在Build窗口中吗?
2.)假设上面问题的答案是肯定的,我的scala.sublime-text文件缺少和/或不正确?
3.)在Scala上使用Sublime Text 2时,我应该看一下额外的资源吗,特别是Scala的Sublime Project文件的方式?
在基于C#的WPF UserControl中,我有一组Sliders来调整Color元素的红色,绿色和蓝色值; 基本上UserControl是一个颜色选择器.我将ToolTipOpening事件处理程序的XAML和C#代码组合在一起,允许我设置表示Color组件属性值的单个整数值.因此,如果我将滑块定位为调整滑块中间颜色的红色数量,则工具提示将显示"红色:125",因为每个颜色组件属性值的范围可以是0到255.代码片段下面的XAML和C#按预期工作:
XAML:
<UserControl x:Class="CustomColorPicker.ColorPickerUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="colorPicker">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="175" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Label HorizontalAlignment="Right">Red:</Label>
<Slider Grid.Row="0" Grid.Column="1" Name="sliderRed" Minimum="0" Maximum="255"
Margin="{Binding ElementName=colorPicker, Path=Padding}"
Value="{Binding ElementName=colorPicker, Path=Red}"
ToolTipOpening="OnColorSliderToolTipOpening"
ToolTip="Red: 0" />
<Label Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right">Green:</Label>
<Slider Grid.Row="1" Grid.Column="1" Name="sliderGreen" Minimum="0" Maximum="255"
Margin="{Binding ElementName=colorPicker, Path=Padding}"
Value="{Binding ElementName=colorPicker, Path=Green}"
ToolTipOpening="OnColorSliderToolTipOpening" ToolTip="Green: 0" />
<Label Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right">Blue:</Label>
<Slider Grid.Row="2" Grid.Column="1" Name="sliderBlue" Minimum="0" Maximum="255" …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个有效的RegEx替换模式,以正确格式化特定的.XML文件名.具体来说,如果文件名不以前缀开头,那么就说ACE_.如果XML文件名和扩展名不以ACE_开头,则将字符串ACE_添加到文件名中.例如,如果我的输入源字符串如下:
Widgets.xml
我想执行一个RegEx Replacement,导致字符串为:
ACE_Widgets.xml.
相反,如果字符串已经以ACE_开头,我希望它保持不变.
另外,如何包含模式".xml"以确保文件名和扩展名的字符串模式以".xml"结尾,并且RegEx替换模式的匹配模式相同?
至于比赛,我有以下运气:
^ACE_{1}[\d\D]+
Run Code Online (Sandbox Code Playgroud)
如果输入字符串是ACE_Widgets.xml,则表示模式匹配,如果字符串是Widgets.xml则不匹配
RegEx模式就足够了,但是如果您需要知道我想要使用的语言,那么替换模式是在.NET 4.0中的C#或VB.NET中.
以下帖子接近我正在寻找的内容,但是包含了*ix目录路径前缀,并且在PHP中使用了preg_replace(),我在使用它时遇到了一些困难我需要去做:
一如既往,感谢您的时间,帮助和耐心.他们非常感谢...