有没有一种方法可以像 System.Math 一样“导入”C#中的静态类?
我提供了一个比较。
我提供了一个比较。
Imports System.Math
Module Module1
Sub Main()
Dim x As Double = Cos(3.14) ''This works
End Sub
End Module
Vs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Math; //Cannot import a class like a namespace
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
double x = Math.Cos(3.14);
double y = Cos(3.14); //Cos does not exist in current context
}
}
}