2011年8月16日 星期二

找出Postgresql 中Primary key的欄位

select c.* 
from information_schema.constraint_column_usage as c, information_schema.table_constraints as t 
where c.constraint_name = t.constraint_name and t.constraint_type = 'PRIMARY KEY';

2011年3月5日 星期六

C# 使用foreach時的注意事項

使用foreach時的注意事項:
  • foreach 在列舉時採用的是強制轉換(force),所以當無法轉換時,會丟出InvalidCastException
  • 在 foreach 中對集合執行新增或移除的動作會出現列舉已經改變的警告,所以若要對操作集合的新增或修改的話,應該使用for loop 或建立一個新的集合物件,再對原本的集合做修改。