如何从案例类别值中获取类别类型

时间:2019-05-22 13:16:59

标签: scala

我有以下代码段:

case class Test(i:Int)

val b = Test // b: Test.type
val a = Test(1) // a: Test

是否有一种方法可以将类型为a的值Test转换为Test.type

1 个答案:

答案 0 :(得分:2)

foreach (Control x in this.Controls) { if (x is Button) { Button newbut = (Button)x; newbut.FlatStyle = FlatStyle.Flat; newbut.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); newbut.FlatAppearance.BorderSize = 0; newbut.TabStop = false; } } 添加到libraryDependencies += scalaOrganization.value % "scala-reflect" % scalaVersion.value,然后您可以尝试

build.sbt