Whats the "Default" keyword in this method?
public IEnumerable<T> createEmpty(Object key)
{
foreach (var item in MyCollection)
{
T element = new T();
element = default(T);
yield return element;
}
}
Whats the "Default" keyword in this method?
public IEnumerable<T> createEmpty(Object key)
{
foreach (var item in MyCollection)
{
T element = new T();
element = default(T);
yield return element;
}
}
You mean the "Default" keyword?
Question already answered here: What does default(object); do in C#?
Thats only a method that returns the default value for that type, for example:
Int32 number = default(Int32); // returns 0
Object myObject = default(Object); // returns null
bool flag = default(bool); // return false