Xamarin shares code between iOS, Android, and Core projects

I am new to Xamarin and made two interfaces for Android and iOS. I have one Core project and links to Android and iOS projects to the main project.

How can I use the code from my main project in an iOS / Android project?

For example, this is my main class TestClass.cs:

using System;
using System.Threading.Tasks;

namespace FindMyRide.Core
{
    public class TestClass
    {

        public string TestString { get; set; }

        public TestClass ()
        {
            TestString = "Hallo";
        }
    }
}

How can I display TestString in an iOS or Android application?

I don't know if this is the use of generic coding in Xamarin, as I said that I am very new to this and to C #.

+3
source share
1 answer

You can create PCLs or create platform-specific libraries with code exchange .

+2
source

All Articles