C#C
C#3y ago
-Epitaph-

How do I use a string from one class to another?

c#
using System;
using System.Net.Http;
using System.Threading.Tasks;

public class Keys {
  public static void Main (string[] args) {
    
    public string APIKey = "Key";
    
    public string URL = $"example.com/key={APIKey}";
    
  }
}

class Call {
  static async Task Main(string[] args) {
    using (HttpClient client = new HttpClient()) {
      HttpResponseMessage response = await client.GetAsync(Keys.URL);
      string result = await response.Content.ReadAsStringAsync();
      Console.WriteLine(result);
    }
    
  }
}


with something like this, how can I use
URL
which is on
Keys
unto
Call
?
Was this page helpful?