Difference between: Constant Vs ReadOnly in C#, with a practical scenario in .Net projects.
Ans:
1. constant has to be assigned at the time of declaration.
readonly can be assigned (only) in the constructor.
2. constants are implicitly static. Cant declared as static.
readonly can be declared as static;
For eg: private static readonly ILoggingService loggingService = LoggingServiceFactory.GetService(typeof(Class Name));
3) Constants are bonded at compile time (=>Faster) , where as value substitution in case of readonly happens at runtime (=>Slower) .
Case Study:
Suppose I have a constant defined in an Assembly(AS) & using it in another Assembly(AD).
After compilation,
Incase of constant it will replace the original string in the IL code, where as in case of read only in IL code still the readonly variable will be present.
Suppose you have changed the constant value in the source assembly, it wont reflect until you compile the destination assembly. :-(
So better to use readonly as static variable though a little bit compromise we have to bear in terms of performance.
Tuesday, May 4, 2010
Monday, May 3, 2010
COCKROACH " STORY : Good one, Must read it..
This is really a wonderful article; If letters are not visible, u can copy it & save as jpg file on ur desktop & read by zooming it :-).
Hope this is going to add some change in our life & how we are responding the situations!!!
Hope this is going to add some change in our life & how we are responding the situations!!!
Tuesday, April 27, 2010
Actual fearlessness & freedom from all worries
Death was walking toward a city one morning and a man asked, "What are you going to do?"
"I'm going to take 100 people." Death replied.
"That's horrible" the man said.
"That's the way it is." Death said. "That's what I do."
The man hurried to warn everyone he could about Death's plan.
As evening fell, he met Death again. "You told me you were going to take 100 people," the man said, "Why did 1,000 die?"
"I kept my word" Death responded. "I only took 100 people. Worry took the other...."
Worry is, and always will be, a fatal disease, for its beginning signals the end of faith. Worry intrudes on God's compassionate ability to provide & protect us. When we allow our problems to overshadow God's promises, we unknowingly, doom ourselves to defeat.
That was never part of God's eternal plans. Release the regrets of yesterday and refuse the fears of tomorrow.
Although the time factor is fearful to everyone, fear personified is afraid of the Supreme Lord, who is therefore known as abhaya, fearless. Taking shelter of the Supreme Lord brings actual fearlessness & freedom from all worries. - Srimad-Bhagavatam 6.9.21
--
Regards,
Friends of Lord Krishna (FOLK)
ISKCON, Bangalore
Visit FOLK at
www.folknet.in
Few words for kindling the inner fire!!!
* The positive thinker sees the invisible, Feels the intangible & achieves the impossible...
* It sometimes seems that intense desire creates not only its own opportunities, but also its own talents!!!
* Always do your best...
What you plant now, U will harvest later.. For sure.
* Nothing can be changed by changing the face...
But everything can be changed by facing the change... Hare Krishna :-)
*Dont be afraid of death,
Be afraid of unlived life...
You dont ve to live forever,
You just have to live King size :-)
* Success is never final,
& Failure is not fatal;
Its courage that counts...
* The joy that you give to others is
the joy that comes back to you !!!
The reverse is also true, be conscious about it...
*The secrete of success in life for a man, is to be ready for his opportunity when it comes!!!
Often we fails, as we assume it to be noise, when opportunity knocks... or we are not ready to face it head on.
*Some people always enjoy the best that life has to offer.It's not because more good things come their way.It's because they find and enjoy the good in whatever that comes their way....
* It sometimes seems that intense desire creates not only its own opportunities, but also its own talents!!!
* Always do your best...
What you plant now, U will harvest later.. For sure.
* Nothing can be changed by changing the face...
But everything can be changed by facing the change... Hare Krishna :-)
*Dont be afraid of death,
Be afraid of unlived life...
You dont ve to live forever,
You just have to live King size :-)
* Success is never final,
& Failure is not fatal;
Its courage that counts...
* The joy that you give to others is
the joy that comes back to you !!!
The reverse is also true, be conscious about it...
*The secrete of success in life for a man, is to be ready for his opportunity when it comes!!!
Often we fails, as we assume it to be noise, when opportunity knocks... or we are not ready to face it head on.
*Some people always enjoy the best that life has to offer.It's not because more good things come their way.It's because they find and enjoy the good in whatever that comes their way....
Tuesday, April 20, 2010
If God exists - Why so much pain and suffering?
A man went to a barbershop to have his hair cut and his beard trimmed. As the barber began to work, they began to have a good conversation. They talked about so many things and various subjects. When they eventually touched on the subject of God, the barber said, “I don’t believe that God exists.”
“Why do you say that,” asked the customer.
“Well, you just have to go out in the street to realize that God doesn’t exist. Tell me, if God exists, would there be so many sick people? Would there be abandoned children? If God existed there would be neither suffering nor pain. I can’t imagine a loving God who would allow all these things.”
The customer thought for a moment but didn’t respond because He didn’t want to start an argument. The barber finished his job and the customer left the shop. Just as he left the barber shop he saw a man in the street with long, string, dirty hair and an untrimmed beard. He looked dirty and unkept. The customer turned back and entered the barbershop again and he said to the barber, “You know what? Barbers do not exist.”
“How can you say that,” asked the surprised barber. “I am here, I am a barber and I just worked on you!” “No!” the customer exclaimed. “Barbers don’t exist because if they did there would be no people with long dirty hair and untrimmed beards like that man outside.” “Ah, but barbers do exists! What happens is people don’t come to me.”
“Exactly,” affirmed the customer. “That’s the point! God, too, does exist! What happens is people do not go to Him or look for Him. That’s why there’s so much pain and suffering in the world.”
Now let me know your perception of God!!! Has He ignored us or its our ignorance & illusion, which kept us deprived of His eternal mercy???
Subscribe to:
Posts (Atom)


