Your question is unclear but I'll give you a quick example using the open source API dotNetRDF that I'm a developer on to just convert between RDF serializations. If this was not what you meant then you need to expand your question to explain what you want to do as others have already commented.
Simplest way to convert between one RDF serialization and another:
Graph g = new Graph();
g.LoadFromFile("input.ttl");
g.SaveToFile("output.rdf");
The above example would take in input.ttl
and attempt to read it as Turtle (does auto-format detection based on file extension) and then attempt to save it as RDF/XML (again does auto-format detection based on file extension).
If your file extensions were not standard you can specify the reader and writer explicitly e.g.
Graph g = new Graph();
g.LoadFromFile("input.temp", new RdfJsonParser());
g.SaveToFile("output.temp", new NTriplesWriter());
That example will read the input file as RDF/JSON and output is as NTriples.
If you are only wanting to do conversion and have large input data to convert there are more memory efficient ways of doing this as the above examples require loading the entire input into memory first. If the input is too big you may hit an OutOfMemoryException
in trying to run the above (if your file is several hundred megabytes then the above method is likely to run into this problem).
If you're interested in seeing the alternative conversion method please comment and I can add examples of leveraging the pure streaming conversion APIs but the code is a bit less obvious than these examples.