SHREE_RAM's blog

By SHREE_RAM, 12 years ago, In English

Hello everyone,

Array in C# is co-variant implicitly on reference type:

object[] listString = new string[] { "string1", "string2" };

But not on value type, so if you change string to int, you will get compiled error:

object[] listInt = new int[] {0, 1}; // compile error

Now, the concern is when you declare int array like two syntaxes below which do not explicitly declare the type int, just only differentiate on new[], compiler will treat differently:

object[] list1 = { 0, 1 };       //compile successfully
object[] list2 = new[] {0, 1};    //compile error

You will get object[] list1 = { 0, 1 }; compiled successfully, butobject[] list2= new[] {0, 1}; compiled error.

It seems the C# compiler treats

object[] list1 = { 0, 1 };

as

object[] list1 = new object[]{ 0, 1 };

but

object[] list2 = new[] { 0, 1 };

as

object[] list2 = new int[]{ 0, 1 };  //error because of co-variant

Why C# compiler behaves in the different way on this case?

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it

By SHREE_RAM, 12 years ago, In English

Hello everyone,

Father's Day was inaugurated in the United States in the early 20th century to complement Mother's Day in celebrating fatherhood and male parenting.

After the success obtained by Anna Jarvis with the promotion of Mother's Day in the US, some wanted to create similar holidays for other family members, and Father's Day was the choice most likely to succeed. There were other persons in the US who independently thought of "Father's Day",but the credit for the modern holiday is often given to Sonora Dode, who was the driving force behind its establishment.

Father's Day was founded in Spokane, Washington at the YMCA in 1910 by Sonora Smart Dodd, who was born in Arkansas. Its first celebration was in the Spokane YMCA on June 19, 1910. Her father, the Civil War veteran William Jackson Smart, was a single parent who raised his six children there. After hearing a sermon about Jarvis' Mother's Day in 1909, she told her pastor that fathers should have a similar holiday honoring them. Although she initially suggested June 5, her father's birthday, the pastors did not have enough time to prepare their sermons, and the celebration was deferred to the third Sunday of June.

So also remember your father on Mother`s Day with your mother.

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it