Kushiwushi
Kushiwushi
CC#
Created by Kushiwushi on 10/24/2024 in #help
✅ NuGet package doesn't exist in current context
No description
96 replies
CC#
Created by Kushiwushi on 4/6/2024 in #help
✅ How to create new cs and csproj files?
No description
20 replies
CC#
Created by Kushiwushi on 12/20/2023 in #help
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);
}

}
}
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
URL
which is on
Keys
Keys
unto
Call
Call
?
7 replies