To get the number of the properties contained by an objects collection (even Anonymous) like the following: We can use the Type.GetProperties method on this way: This code works even on Net Core.
If we have an Angular client app that needs to download a file (for example a PDF file) from an Asp Net Core 2 api Controller , we can follow what is described in this post. The first implementation is on the server side (an Asp Net Core 2 Controller). So, for example into our controller UserController, […]
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 […]
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 […]
C# Remove UtcOffset from DateTime : DateTime contains UTC format informations. To remove UTC informations we need to create an instance of DateTime using its Ticks property. For example:
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” […]
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.