프로그래밍
Port 개체등록 및 가져오기 방법 예제
준이바라기얍
2021. 8. 20. 15:10
반응형
Port 개체등록 및 가져오기 방법 예제 입니다.
그냥 구조만 참조하세요.
public bool AddPort(int intPortID)
{
clsPort dclsPort; //Port 개체 선언
try
{
int dintPortID = intPortID;
if (dintPortID <= 0)
{
return false;
}
else
{
if (HashPort.Contains(dintPortID))
{
return true;
}
else
{
dclsPort = new clsPort(dintPortID);
HashPort.Add(dintPortID, dclsPort);
return true;
}
}
}
catch
{
return false;
}
finally
{
}
}
public clsPort Port(int intPortID)
{
try
{
int dintPortID = intPortID;
if (HashPort.Contains(dintPortID))
{
return (clsPort)HashPort[dintPortID];
}
else
{
return null;
}
}
catch
{
return null;
}
finally
{
}
}
public ICollection Port()
{
try
{
return HashPort.Keys;
}
catch
{
return null;
}
finally
{
}
}
public int PortCount
{
get { return HashPort.Count; }
}
반응형