如何将一个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