📄 personinterop.cs
字号:
using System.Reflection;
using System.Runtime.InteropServices;
[assembly:AssemblyKeyFile("PersonInterop.snk")]
namespace Wrox
{
public interface IPersonInterop
{
//person();
//person(string firstName, string lastName);
string FirstName{get; set;}
string LastName{get; set;}
string FullName();
}
public class PersonInterop : IPersonInterop
{
private string _firstName;
private string _lastName;
public PersonInterop() {}
public PersonInterop(string firstName, string lastName)
{
_firstName = firstName;
_lastName = lastName;
}
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
public string FullName()
{
return _firstName + " " + _lastName;
}
}
[ClassInterfaceAttribute(ClassInterfaceType.AutoDual)]
public class PersonInterop1
{
private string _firstName;
private string _lastName;
public PersonInterop1() {}
public PersonInterop1(string firstName, string lastName)
{
_firstName = firstName;
_lastName = lastName;
}
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
public string FullName()
{
return _firstName + " " + _lastName;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -