What is Spirituality ?

I am definitely not a qualified person to talk about spirituality. But, I think I am beginning to understand this topic and definitely would like to explore this topic in coming days.

I just want to clear the air as there is a lot of confusion and misinterpretation on this topic. First thing first – If you want to really understand any new topic, you got to keep little bit of an open mind and give some time to yourself. The same rule applies here as well, or may be more of that openness is required in this topic since few things are beyond rationale or logical per se.

To make you understand in simple words – Spiritual means going beyond physicality, and understanding life to its full potential. Let me explain what these words exactly mean.

What we think we know about the world isn’t everything to it. If you think you know it all then its definitely a crown of ignorance. No matter how much you know it is still beyond ones reach. The innate quality of human life is a state where he is always longing to ‘ve more than what he already has, its sort of continuous quest. Lets say you have lots of money, but you still want accumulate endlessly, this explains why rich people are more greedier than not so rich people. Similarly the knowledge, love etc.

Well, let’s end this topic for now.

Puzzle #1

Puzzle: There are three boxes, first box contains Apples,  second box contains Oranges and the third box contains mix of both Apples and Oranges. Each box is wrongly labeled. You have got only once chance to open any box and pick up only one fruit without looking inside the box. The question is that which box would you choose to open and pick a single fruit so that you can tell what each box contains.

Answer: It is the boxed labeled with “Mixed Fruits”. The simple reason for this is when you pick up the box labeled with “Mixed Fruit”, either you could pick up Orange or Apple, and for sure this box would not have mixed fruits since the label must be wrong. So using these two facts we can conclude content of all the three boxes. If you happen to pick Apple, all the fruits must be apple in that box, and same thing for Orange, and the remaining two boxes must not contain what it is labeled, so the second box contains fruits labeled on third box and vice-versa.

I hope you liked the puzzle and the above answer is clear enough for you to understand.

How to return multiple values from a method in C#

As a developer how many times you may have wondered that wish I could return at least two values, instead of creating a object, from a method just the way we could return a single value.

Before, we jump into the solution, we can look at different ways we can return multiple values as we know currently.

  1. Create a class, and return the object of that class type.
  2. Pass the out parameters, and assign those variables in the method.
  3. Pass a ref object and assign the values in the method.
  4. Declare the Global variables (class level variables), and can be access anywhere.

Now the curiosity poses to know that what is the another way beside above options.

We can use Tuple keyword to achieve returning multiple values from the method as we see in the below example.

public static void Main(string[] args)
{
    int userId = 0;
    Tuple<string, string> userData = GetUserData(userId);
}

public static Tuple<string, string> GetUserData(int userId)
{
    return new Tuple<string, string>("Hello", "World");
}

The first question comes to our mind that we can as well create a class or struct and return it, but sometimes it is inconvenient to create class or struct all the time.

Link to Further reading