{"id":28477,"date":"2019-06-25T00:00:00","date_gmt":"2019-06-24T22:00:00","guid":{"rendered":"https:\/\/blexin.com\/conversioni-di-tipi-custom-in-c\/"},"modified":"2021-05-20T19:05:45","modified_gmt":"2021-05-20T17:05:45","slug":"custom-type-conversion-in-c","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/","title":{"rendered":"Custom Type Conversion in C#"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"28471\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/attachment\/cd5fc5d7-3ac0-4953-a865-5a3672764e76-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"cd5fc5d7-3ac0-4953-a865-5a3672764e76\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=300%2C178&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-28471\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>A professional code developer needs solid foundation. Our daily work can drive us away from what we have studied, as well as the routine can push us to repeat always the same mistakes. A review of the fundamentals is a useful exercise, can&#8217;t be bad! So let&#8217;s take advantage of this post to talk about our favorite programming language.<\/p>\n\n\n\n<p>C# is static\/strongly-typed in compile-time. After declaring a variable, it cannot be assigned to a value of another type unless this type is implicitly convertible to the type of the variable itself. So we can have these types of conversions:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Implicit<\/strong>: for this type of conversion we don&#8217;t need any particular syntax and there will be no data loss<\/li><li><strong>Explicit<\/strong>: when there is data loss possibility (for example if we try to convert a variable of a given type that has a value greater than the maximum value that can be stored in the type of the host variable), the conversion is called narrowing. The compiler requires us (otherwise it doesn&#8217;t compile) to perform an explicit conversion called cast. A cast is performed by specifying, between round brackets, the type of data before the variable or value to be converted. We are thus informing the compiler that we are aware of the possibility of information loss.<\/li><\/ul>\n\n\n\n<p>For numeric types, when there is the certainty of no information loss, because the type of the host variable can certainly contain the value of the variable to be converted, the conversion is called&nbsp;<em>widening<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nint numInt = 1000;\nlong numLong = i;\n<\/pre><\/div>\n\n\n<p>For reference types there is always an implicit conversion from a class to a direct or indirect base class or to implemented interfaces.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nDipendente dip = new Dipendente();\nPersona pers = dip;\nlong numLong = 2000;\nint numInt = (int)numLong;\n<\/pre><\/div>\n\n\n<p>Note: This assignment compiles correctly, but it may generate an exception (<em>OverflowException<\/em>) at runtime if the value of the type to be converted (<em>numLong<\/em>) is outside the range of the destination variable type (<em>numInt<\/em>).<\/p>\n\n\n\n<p>The same happens for reference types. If we want to convert a variable of the base class type to a derived class type, we need to perform an explicit cast.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nPersona pers = new Persona();\nDipendente dip = (Dipendente)pers;\n<\/pre><\/div>\n\n\n<p>Note: This assignment compiles correctly, but it may generate an exception (<em>InvalidCastException<\/em>) at runtime if the object on the right (<em>pers<\/em>) is not of the type specified with the cast (<em>Employee<\/em>).<\/p>\n\n\n\n<p>And if the conversion would take place between types that are not compatible with each other? In this case, helper class methods can help us. If we wanted, for example, convert a string to a number, we could use the&nbsp;<em>Parse&nbsp;<\/em>or&nbsp;<em>TryParse<\/em>&nbsp;methods.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nstring testo = &quot;100&quot;;\nint numero = int.Parse(testo);\n<\/pre><\/div>\n\n\n<p>If we wanted to convert a byte array to an Int64, we could use the BitConverter class and its method ToInt64(byte[] value, int startIndex):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nbyte&#x5B;] bytes = {3,5,2,8};\nInt64 valoreInt64 = BitConverter.ToInt64( bytes, 0 );\n<\/pre><\/div>\n\n\n<p>How is treated, instead, the conversion between classes defined by us? Also in this case, we might need to assign a different type to a variable of a given type.<\/p>\n\n\n\n<p>C # allows us to create static methods that use special operators (implicit and explicit) in their statements and to specify that way conversions within a class, allowing us to convert it to and \/or in another class. All without inheritance relationships between them or an interface that join them. In theory, therefore, no conversion would be possible. Let&#8217;s look at a practical example to clarify our ideas. This code implicitly converts from the&nbsp;<em>NewProduct<\/em>&nbsp;type to the<em>&nbsp;OldProduct<\/em>&nbsp;type:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nclass VecchioProdotto\n{\n\u00a0\u00a0\u00a0public static implicit operator VecchioProdotto(NuovoProdotto np)\n\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0VecchioProdotto vp = new VecchioProdotto();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0vp.nomeProdotto = np.nome;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0vp.descrizioneProdotto = np.descrizione;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0vp.matricola = np.codiceIdentificativo;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return vp;\n\u00a0\u00a0\u00a0\u00a0\n}\n<\/pre><\/div>\n\n\n<p>In this static method, which will be used automatically in the conversion phase, we have mapped the properties of&nbsp;<em>OldProduct&nbsp;<\/em>class on those of the&nbsp;<em>NewProduct<\/em>&nbsp;class. Therefore, we can now write:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nVecchioProdotto vp = np;\n<\/pre><\/div>\n\n\n<p>In this case, instead, we see an explicit conversion function (which requires a cast) that converts from the&nbsp;<em>OldProduct<\/em>&nbsp;to the&nbsp;<em>NewProduct<\/em>&nbsp;type:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nclass NuovoProdotto \/\/Avremmo potuto indifferentemente inserire la funzione all&#039;interno della classe VecchioProdotto\n{\n\u00a0\u00a0\u00a0public static explicit operator NuovoProdotto(VecchioProdotto vp)\n\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0NuovoProdotto np = new NuovoProdotto();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0np.nome = vp.nomeProdotto;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0np.descrizione = vp.descrizioneProdotto;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0np.codiceIdentificativo = vp.matricola + vp.idTipologia;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return np;\n\u00a0\u00a0\u00a0\u00a0\n}\n<\/pre><\/div>\n\n\n<p>In this case we will write:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nNuovoProdotto npr = (NuovoProdotto)vp;\n<\/pre><\/div>\n\n\n<p>User-defined type conversions can take place as well as between custom types, as we have already seen, even between a base type and a non-compatible custom type. However, it is not possible to define again an already existing conversion (implicit or explicit). We can declare a conversion function with the implicit and explicit operators from a source type to a destination type, following these rules:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Neither the origin nor the destination must be of an interface or object type<\/li><li>The source or target is a class or struct within which occurs the operator&#8217;s declaration.<\/li><li>In case of conversion between two classes, the declaration can take place either in the origin class or in the destination class.<\/li><li>The origin and destination must not be base classes or derived from each other.<\/li><li>The function must be public and static, there is no return type and the name must coincide with the destination type<\/li><\/ul>\n\n\n\n<p>Ultimately, if a user-defined conversion can result in exceptions or data loss, then it must be defined with the explicit operator.<\/p>\n\n\n\n<p>User-defined conversions with the implicit operator must be designed so that they never generate exceptions and that there is no data loss.<\/p>\n\n\n\n<p>I hope it could be useful<\/p>\n\n\n\n<p>See you next time!<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s see how to perform conversions between incompatible types in C# with implicit and explicit operators<\/p>\n","protected":false},"author":196716244,"featured_media":28471,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[688637524],"tags":[688637384],"class_list":["post-28477","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-c-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom Type Conversion in C# - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Type Conversion in C# - Blexin\" \/>\n<meta property=\"og:description\" content=\"Let&#039;s see how to perform conversions between incompatible types in C# with implicit and explicit operators\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-24T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-20T17:05:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i2.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Francesco Vastarella\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Francesco Vastarella\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\"},\"author\":{\"name\":\"Francesco Vastarella\",\"@id\":\"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d\"},\"headline\":\"Custom Type Conversion in C#\",\"datePublished\":\"2019-06-24T22:00:00+00:00\",\"dateModified\":\"2021-05-20T17:05:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\"},\"wordCount\":840,\"image\":{\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1\",\"keywords\":[\"C#\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\",\"url\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\",\"name\":\"Custom Type Conversion in C# - Blexin\",\"isPartOf\":{\"@id\":\"https:\/\/blexin.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2019-06-24T22:00:00+00:00\",\"dateModified\":\"2021-05-20T17:05:45+00:00\",\"author\":{\"@id\":\"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d\"},\"breadcrumb\":{\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blexin.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom Type Conversion in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blexin.com\/en\/#website\",\"url\":\"https:\/\/blexin.com\/en\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blexin.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d\",\"name\":\"Francesco Vastarella\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blexin.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g\",\"caption\":\"Francesco Vastarella\"},\"url\":\"https:\/\/blexin.com\/en\/author\/francesco-vastarellablexin-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom Type Conversion in C# - Blexin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/","og_locale":"en_US","og_type":"article","og_title":"Custom Type Conversion in C# - Blexin","og_description":"Let's see how to perform conversions between incompatible types in C# with implicit and explicit operators","og_url":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/","og_site_name":"Blexin","article_published_time":"2019-06-24T22:00:00+00:00","article_modified_time":"2021-05-20T17:05:45+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i2.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Francesco Vastarella","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Francesco Vastarella","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/"},"author":{"name":"Francesco Vastarella","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d"},"headline":"Custom Type Conversion in C#","datePublished":"2019-06-24T22:00:00+00:00","dateModified":"2021-05-20T17:05:45+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/"},"wordCount":840,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1","keywords":["C#"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/","url":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/","name":"Custom Type Conversion in C# - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1","datePublished":"2019-06-24T22:00:00+00:00","dateModified":"2021-05-20T17:05:45+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/custom-type-conversion-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Custom Type Conversion in C#"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d","name":"Francesco Vastarella","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g","caption":"Francesco Vastarella"},"url":"https:\/\/blexin.com\/en\/author\/francesco-vastarellablexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/cd5fc5d7-3ac0-4953-a865-5a3672764e76.png?fit=1024%2C608&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-7pj","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/28477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716244"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=28477"}],"version-history":[{"count":5,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/28477\/revisions"}],"predecessor-version":[{"id":31982,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/28477\/revisions\/31982"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/28471"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=28477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=28477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=28477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}