The process of generating c# classes off the xsd is usually rather simple. One needs the xsd.exe utility (for example located here: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools) and then a simple command to get things done:
xsd schema.xsd /c
Sometimes there may be some problems though with missing refs, namespaces and such.
In this example, I will generate classes for WMS 1.3.0 based on the OGC schemas - it is possible to grab them one by one, or all the goodies wrapped as a zip archive.
I have extracted WMS 1.3.0 schemas to f:\wms\schemas, so my command should look like this when in f:\wms (I have copied xsd.exe there too):
xsd schemas\capabilities_1_3_0.xsd /c
Unfortunately there are some problems and classes do not get generated:
The problem here is caused by unresolved references. Xsd was not able to find xlink.xsd. Although there is a xlink schema in OGC repo, this is not the one we're after. The one in question is the mentioned http://www.w3.org/1999/xlink, and its schema definition is http://www.w3.org/1999/xlink.xsd, pretty much as defined in the very beginning of the capabilities_1_3_0.xsd I am trying to process:
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/wms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wms="http://www.opengis.net/wms" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="184.108.40.206">
WMS is an OGC Standard.
Copyright (c) 2004,2010 Open Geospatial Consortium.
To obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink.xsd"/>
Unfortunately xsd.exe does not resolve the import automatically, so in order to make it work I just copied the xlinx.xsd to my schemas folder and specified it in the command:
xsd schemas\xlink.xsd schemas\capabilities_1_3_0.xsd /c
Looks like this did the trick and the classes got generated as expected. The complete set of files is here: ogc_wms_cs_from_xsd.zip (51.1KB)