1. 첫번째.
class Test
{
public struct Point
{
public DateTime lastRecorded;
public TimeSpan totalTime;
public int totalCalls;
}
private Dictionarydic = new Dictionary ();
public void SetValue(string tag, out point)
{
dic.TryGetValue(tag, out point);
point.totalCalls= 1;
dic[tag] = point;
}
}
2. 두번째
class Test
{
public struct Point
{
public DateTime lastRecorded;
public TimeSpan totalTime;
public int totalCalls;
}
private Dictionary
public void SetValue(string tag, out point)
{
dic.TryGetValue(tag, out point);
point.totalCalls= 1;
//dic[tag] = point; // 전체 복사 아니라면 dictionary 내에 값은 변경됨.
}
}
댓글
댓글 쓰기