如何將一個c#文件包含到另一個c#文件中?如何將一個c#文件包含到另一個c#文件中?
我有兩個c#文件就像一個是test.cs,另一個是main.cs.我想將test.cs包含到main.c中。
test.cs中文件的代碼
// you can use Console.WriteLine for debugging
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Solution
{
public bool solution(long number1, int[,] arr1,int dim_2,int dim_3)
{
//some code here
}
}
main.cs代碼
using System;
include test.cs;
class Group
{
public static void Main(String[] args)
{
long number1 = 5;
int [,] arr1 = new int[,] {{0, 0},{1, 1},{2, 2},{3, 3},{4, 4}};
int dim_2 = 5;
int dim_3 = 2;
Solution object_class = new Solution();
bool result = object_class.solution (number1, arr1, dim_2, dim_3);
Console.WriteLine("Return :");
Console.WriteLine(result);
}
}
什麼,我做錯了什麼?請幫幫我。
預先感謝您
你應該'使用'其他類,而不是'#include'它。你爲什麼要包括? – 2015-04-04 07:34:24
您必須在同一個項目中添加這兩個文件.....幷包含test.cs.這裏不需要。 – 2015-04-04 07:49:13