Hello! I am new to c #, but I know java well.
The question that I am asking now should be very easy: how to cache and retrieve from the cache?
For example, when you contact some Internet address, first search in the cache, if there is no cache, then you get this content from the Internet and put it in the cache
If you know C # and Java, below I gave Java code
You can answer this question without knowing Java.
Main.java
import org.apache.commons.io.IOUtils; import java.io.IOException; import java.io.InputStream; import java.net.*; import java.util.List; import java.util.Map; public class Main { public static void main(String[] args) throws Exception { ResponseCache.setDefault(new ResponseCache() { @Override public CacheResponse get(URI uri, String rqstMethod, Map<String, List<String>> rqstHeaders) throws IOException { if (uri.toString().equals("http://google.com/")) { return new CacheResponse() { @Override public Map<String, List<String>> getHeaders() throws IOException { return null; } @Override public InputStream getBody() throws IOException { return null; } }; } return null; } @Override public CacheRequest put(URI uri, URLConnection conn) throws IOException { return null; } }); URLConnection c = new URL("http://google.com/").openConnection(); c.setUseCaches(true); String html = IOUtils.toString(c.getInputStream()); System.out.println(html); } } Please provide an example of C # code by analogy with my code.