personinterop.cs
来自「东软内部材料(四)asp等相关的教学案例 」· CS 代码 · 共 83 行
CS
83 行
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 + =
减小字号Ctrl + -
显示快捷键?