C#: how to validate XML with a set of XSD schemas

When we are using an XSD schema to validate an XML document, if this schema has other nested XSD schemas, if we have a myCustomType declared into the nested XSD and we don’t use XmlSchemaSet to validating the XML, we can get the error: Type ‘myCustomType‘ is not declared For example, if we have the myCustomType defined […]

En Lire Plus

C#: how to convert a String to DateTime ignoring TimeZone

C# convert a String to DateTime : To convert a String into a DateTime we can use the DateTime.Parse method. For example: Now the myDt contains a date with 02/10/2018 11:25:27 value (on italian format). But if our string date include TimeZone informations, if we use DateTime.Parse method, we get a wrong value: Now the myDt […]

En Lire Plus

C#: create proxy class from WSDL

If we have a WSDL file and we want to create the C# proxy class we can use the svcutil.exe (Windows SDK ServiceModel Metadata Utility Tool). Suppose we have saved the WSDL file InteropService.wsdl into the folder C:\Tmp. We can execute this command to create the C# proxy class: “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\svcutil.exe” […]

En Lire Plus

LINQ – Search into a List a joined string

LINQ Search into a List a joined string : If we have a string whose values are joined with a character (for example a comma) we can use the condition Any to determine if some element of the sequence satisfies a condition and use the Contains in the condition to find the string.

En Lire Plus