Archive for June, 2008

variable check – c#

I am getting accustomed to using the single line ‘If’s.. they are very handy inside the getter-setter. You basically do it like this..

private string m_someVariableName;
Public string SomeVariableName{
get { return someVariableName == null? “my_default_text”: someVariableName; }
set {m_someVariableName = value ; }
}

What if there is a boolean variable? well, you might not even need to check it like this, but I thought maybe we could use something like..

private bool m_someVariableName;
Public bool SomeVariableName{
get { return someVariableName.ToString() == null? true : someVariableName; }
set {m_someVariableName = value ; }
}

and if it is a string [ ] array? I am trying this out, lets see if it works.

private string[ ] m_someVariableName;
Public string [ ] SomeVariableName{
get { return someVariableName.Length==0? “do something” : m_someVariableName ; }
set {m_someVariableName = value ; }
}

If any of you are using similar methods for quicker processing, or if any of these codes helped you, leave me a note!

Comments (1)

jobs@Phd

After the comic strip went on and on about how difficult it is for a post.doc to get a job ( Mike’s struggles!! hehehee..) I saw a link that appeared with job offers for them! :D

I hope mike find some good jobs now!

Leave a Comment

Concept of capital and small

Have you wondered, why we don’t have small numbers? I was looking at my user_id this morning and it was some 8-digit number. While my colleague scribbled in my ID,I was thinking wouldn’t it be nice to have capital numbers and small numbers? There could be instructions about WRITE the numbers in all CAPS! Food for thought : How should the numbers look?

Comments (2)