Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How fair is this?

How fair is this?

Scheduled Pinned Locked Moved The Lounge
question
21 Posts 12 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard DeemingR Richard Deeming

    bool? is a nullable value type[^]. Null conditional operators[^] are something completely different. :)


    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

    E Offline
    E Offline
    Eytukan
    wrote on last edited by
    #12

    You just made it double productive :-D :thumbsup: thanks I was just thinking how can I google that. Then just went by searching ? operator in C#

    Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

    1 Reply Last reply
    0
    • E Eytukan

      If someone stores 'Sex' attrib as

      bool isMale;

      haha just seen this in code. :-D

      Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

      F Offline
      F Offline
      F ES Sitecore
      wrote on last edited by
      #13

      Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

      public class Gender
      {
      public string Key { get; set; }
      public string Description { get; set; }
      public string PronounSubset { get; set; }
      }

      HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
      request.Method = "GET";
      request.ContentType = "application/json";
      WebResponse response = request.GetResponse();
      using (var reader = new StreamReader(response.GetResponseStream()))
      {
      string data = reader.ReadToEnd();

      JavaScriptSerializer s = new JavaScriptSerializer();
      var genders = s.Deserialize\>(data);
      
      foreach(var gender in genders)
      {
          System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
      }
      

      }

      D B Z F 4 Replies Last reply
      0
      • F F ES Sitecore

        Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

        public class Gender
        {
        public string Key { get; set; }
        public string Description { get; set; }
        public string PronounSubset { get; set; }
        }

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
        request.Method = "GET";
        request.ContentType = "application/json";
        WebResponse response = request.GetResponse();
        using (var reader = new StreamReader(response.GetResponseStream()))
        {
        string data = reader.ReadToEnd();

        JavaScriptSerializer s = new JavaScriptSerializer();
        var genders = s.Deserialize\>(data);
        
        foreach(var gender in genders)
        {
            System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
        }
        

        }

        D Offline
        D Offline
        Daniel Pfeffer
        wrote on last edited by
        #14

        :omg: :wtf: It won't help; you're bound to offend someone, anyway...

        Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

        1 Reply Last reply
        0
        • F F ES Sitecore

          Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

          public class Gender
          {
          public string Key { get; set; }
          public string Description { get; set; }
          public string PronounSubset { get; set; }
          }

          HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
          request.Method = "GET";
          request.ContentType = "application/json";
          WebResponse response = request.GetResponse();
          using (var reader = new StreamReader(response.GetResponseStream()))
          {
          string data = reader.ReadToEnd();

          JavaScriptSerializer s = new JavaScriptSerializer();
          var genders = s.Deserialize\>(data);
          
          foreach(var gender in genders)
          {
              System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
          }
          

          }

          B Offline
          B Offline
          Bassam Abdul Baki
          wrote on last edited by
          #15

          Shouldn't the female be 0 and the male be 1?

          Web - BM - RSS - Math - LinkedIn

          1 Reply Last reply
          0
          • F F ES Sitecore

            Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

            public class Gender
            {
            public string Key { get; set; }
            public string Description { get; set; }
            public string PronounSubset { get; set; }
            }

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
            request.Method = "GET";
            request.ContentType = "application/json";
            WebResponse response = request.GetResponse();
            using (var reader = new StreamReader(response.GetResponseStream()))
            {
            string data = reader.ReadToEnd();

            JavaScriptSerializer s = new JavaScriptSerializer();
            var genders = s.Deserialize\>(data);
            
            foreach(var gender in genders)
            {
                System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
            }
            

            }

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #16

            I really hope this is a joke. :sigh:

            Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

            1 Reply Last reply
            0
            • F F ES Sitecore

              Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

              public class Gender
              {
              public string Key { get; set; }
              public string Description { get; set; }
              public string PronounSubset { get; set; }
              }

              HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
              request.Method = "GET";
              request.ContentType = "application/json";
              WebResponse response = request.GetResponse();
              using (var reader = new StreamReader(response.GetResponseStream()))
              {
              string data = reader.ReadToEnd();

              JavaScriptSerializer s = new JavaScriptSerializer();
              var genders = s.Deserialize\>(data);
              
              foreach(var gender in genders)
              {
                  System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
              }
              

              }

              F Offline
              F Offline
              Forogar
              wrote on last edited by
              #17

              I thought, "This looks handy. Let me try it." I have my own API_KEY so I set up in the call but couldn't make it work to genders.googleapis.com - I got a 404 error. Any ideas?

              - I would love to change the world, but they won’t give me the source code.

              N 1 Reply Last reply
              0
              • E Eytukan

                I just love it, when a fun post turns out to be a productive one. I'm just discovering this "null-conditional Operators" :laugh: I'm a bit outdated, may be C# 4.0, that's when I became a manager. lol happy to take away these cool tips :beer: Thanks Marc!

                Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #18

                Vunic wrote:

                Thanks Marc!

                YW! Richard beat me to it, but my favorites are continuation and coalescing operators, so you can write stuff like this (not that you'd want to, mind you, at least without really thinking about whether your data model is really right, but really handy when you need it!):

                int? n;
                string ns = n?.ToString() ?? "0"; // oops, forgot the quotes in the original post.

                Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                E 1 Reply Last reply
                0
                • M Marc Clifton

                  Vunic wrote:

                  Thanks Marc!

                  YW! Richard beat me to it, but my favorites are continuation and coalescing operators, so you can write stuff like this (not that you'd want to, mind you, at least without really thinking about whether your data model is really right, but really handy when you need it!):

                  int? n;
                  string ns = n?.ToString() ?? "0"; // oops, forgot the quotes in the original post.

                  Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  E Offline
                  E Offline
                  Eytukan
                  wrote on last edited by
                  #19

                  :thumbsup: thanks. :)

                  Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                  1 Reply Last reply
                  0
                  • F Forogar

                    I thought, "This looks handy. Let me try it." I have my own API_KEY so I set up in the call but couldn't make it work to genders.googleapis.com - I got a 404 error. Any ideas?

                    - I would love to change the world, but they won’t give me the source code.

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #20

                    He was probably joking. The Android SDK defines it as female, male, or other. See [Person.Gender  |  Google APIs for Android  |  Google Developers](https://developers.google.com/android/reference/com/google/android/gms/plus/model/people/Person.Gender)

                    Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                    F 1 Reply Last reply
                    0
                    • N Nish Nishant

                      He was probably joking. The Android SDK defines it as female, male, or other. See [Person.Gender  |  Google APIs for Android  |  Google Developers](https://developers.google.com/android/reference/com/google/android/gms/plus/model/people/Person.Gender)

                      Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                      F Offline
                      F Offline
                      Forogar
                      wrote on last edited by
                      #21

                      Thanks Nish. I have given up on it for now. For my applications from now on there will be Male, Female or Undecided - I think that covers it.

                      - I would love to change the world, but they won’t give me the source code.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups