Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9288235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:52:06+00:00 2026-06-18T19:52:06+00:00

In my monodroid application many types I need to assign CLLocation object to null

  • 0

In my monodroid application many types I need to assign CLLocation object to null value. I need it in order to detect some specific conditions.For example suppose a function that do something to CLLocationCoordinate2D objects and we want that if and exeption accourd to this function it returns null.But monotouch do not allow null value for this type.

This is the test Method that I used for this propose:

        private static CLLocationCoordinate2D sampleMethod ()
    {
        try {
            return new CLLocationCoordinate2D ();
        } catch (Exception ex) {
            return null;
        }
    }

and the error accord:

Error CS0037: Cannot convert null to `MonoTouch.CoreLocation.CLLocationCoordinate2D' because it is a value type (CS0037) (Realtyna_iPhone_Project)

In this states how we should do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:52:07+00:00Added an answer on June 18, 2026 at 7:52 pm

    CLLocationCooredinate2D is a value type, which cannot be null. However, C# allows you to wrap value types in a Nullable wrapper, so that they can contain null values.

    For example, this should be valid:

    private CLLocationCoordinate2D? ProcessLocation ()
    {
        CLLocationCoordinate2D? retLoc;
    
        try {
            // do something with retLoc here
        } catch (Exception ex) {
            retLoc = null;
        }
    
        return retLoc;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Monodroid application that does many webrequests. I am making requests from
I am converting some java code C# for use in my MonoDroid application. I
I have a monodroid application that uses a .net library that contains normal .resx
I am developing a app using Monodroid (C#) and wanted to some good looking
How does one turn any random object into a JSON string using Monodroid's System.Json
My monodroid application builds fine and deploys to the device; however the application dies
In my monodroid application I have an activity that users may roatate it. when
I used monodroid to develop an application for android. Now, I want to develop
Has anyone imported this sliding menu project https://github.com/jfeinstein10/SlidingMenu in their Monodroid application? I've imported
I am using the Cairo.Matrix dll in my monoandroid application to load the some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.