dimanche 29 janvier 2017

Calling IF Statement method in C#

I have noticed that I am repeating a lot of my code.. What I want to do is store the below if-statement in a method so that it can be called at any time. Below is an example of my code.

if (result.Equals("") && type == "")
            {
                JObject jobj = JObject.Parse(Helper.callerClass(@""));
                var titleTokens = jobj.SelectTokens("...title");
                var values = titleTokens.Select(x => (x as JProperty).Value);

                if (titleTokens.Contains(s))
                {
                    MessageBox.Show("");
                }
                else
                {
                    MessageBox.Show("");
                }
            } 

Aucun commentaire:

Enregistrer un commentaire