The first compiles and runs . The second one fails because the method call returns an `ICollection`. 

The following code works fine 

```
foreach (XmlSchema schema in schemaSet.Schemas(targetNamespace)) 
{
    Id = schema.Id;
    Version = schema.Version;             
}

```

Since I am going to to get only one schema, why not go ahead and do this 

```
XmlSchema schema = schemaSet.Schemas(targetNamespace);
Id = schema.Id;
Version = schema.Version;

```

There has to be something which is similar to the second one which will work?

How can this be done?