做一个WPF,怎么写完类后,实例化成功了,却不能引用呢?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication2
{
public class MyClass1
{
public void MyClass1();
private string result;
public string Result
{
get { return result; }
set { result = value; }
}
}
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public class trans
{
[DllImport("trans.dll")]
public static extern int transmain(String exportpath, String importpath);
}
public partial class Main : Window
{
MyClass1 mainout=new MyClass1 ();
mainout.Result="there will show ,if transform is ok ";
------解决思路----------------------
public class MyClass1
{
public void MyClass1();
private string result;
public string Result
{
get { return result; }
set { result = value; }
}
}
public void MyClass1();这么干能编译通过么?
------解决思路----------------------
mainout.Result="there will show ,if transform is ok ";
定义到方法内
------解决思路----------------------
感觉构造函数应该是这样写的吧
public void MyClass1()
{
result="null";
}
public MyClass1()
{
result="null";
}
不要void
------解决思路----------------------
public void MyClass1()
{
result="null";
}
-》
这。。。构造函数 怎么能有void!!!!
------解决思路----------------------