<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-431738679124133696</id><updated>2025-03-28T07:28:49.838+01:00</updated><category term="VB.NET"/><category term="Tips"/><category term="Optimización"/><category term="Reflection"/><category term="Silverlight"/><category term="Visual Studio"/><category term="Code Snippet"/><category term="Curiosidades"/><category term="Enum"/><category term="Excepciones"/><category term="Extensión"/><category term="Freaks"/><category term="Herencia"/><category term="IDE"/><category term="Patrones de diseño"/><category term="Programación asíncrona"/><category term="Refactoring"/><category term="SQL"/><category term="SQL Server"/><category term="Serialization"/><category term="SolidColorBrush"/><category term="Threading"/><category term="Xml"/><title type='text'>Dim VisualBasic.net</title><subtitle type='html'>Blog dedicado a Visual Basic.Net</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-2622733243108434814</id><published>2010-11-23T23:48:00.002+01:00</published><updated>2014-04-20T23:45:55.862+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><title type='text'>Silverlight Tip - Mostrar el Número de versión</title><content type='html'>Si estás desarrollando una aplicación en &lt;a href=&quot;http://www.silverlight.net/&quot;&gt;Silverlight&lt;/a&gt; y quieres mostrar el número de versión de tu aplicación, una vez tengas configurado el fichero&amp;nbsp;&lt;b&gt;AssemblyInfo.vb&lt;/b&gt;&amp;nbsp;de tu proyecto, añade el siguiente código:&lt;br /&gt;
&lt;pre class=&quot;brush: vb&quot;&gt;Dim FullName As String = Assembly.GetExecutingAssembly().FullName
Dim Name As AssemblyName = New AssemblyName(FullName)
Dim Version As System.Version = Name.Version

VersionNumber.Text = String.Format(&quot;Mi Programa v{0}.{1}.{2}&quot;, 
                                   Version.Major, 
                                   Version.Minor,
                                   Version.Build)
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/2622733243108434814/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/11/silverlight-tip-mostrar-el-numero-de.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/2622733243108434814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/2622733243108434814'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/11/silverlight-tip-mostrar-el-numero-de.html' title='Silverlight Tip - Mostrar el Número de versión'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-1052834418108881129</id><published>2010-02-13T20:55:00.003+01:00</published><updated>2010-02-13T21:04:38.604+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight"/><category scheme="http://www.blogger.com/atom/ns#" term="SolidColorBrush"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><title type='text'>Silverlight: Convertir un nombre de color predefinido a SolidColorBrush</title><content type='html'>&lt;p&gt;Si trabajas con &lt;a href=&quot;http://silverlight.net&quot;&gt;Silverlight&lt;/a&gt; es posible que necesites utilizar nombre de colores (&amp;quot;Green&amp;quot;,&amp;quot;Black&amp;quot;, &amp;quot;DarkGreen&amp;quot;, etc.) para las propiedades relacionadas con colores. Si intentas hacer esto mismo desde código te encontrarás que no hay ninguna función que convierta el &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/system.string(VS.80).aspx&quot;&gt;String&lt;/a&gt; a un objeto del tipo &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/system.windows.media.solidcolorbrush(VS.95).aspx&quot;&gt;SolidColorBrush&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Googleando un poco he llegado al siguiente post: &lt;a href=&quot;http://silverlightedweb.blogspot.com/2008/04/color-solidcolorbrush-object-from-color.html&quot;&gt;My Silverlight experiences: Color / SolidColorBrush object from color name in silverlight&lt;/a&gt; El código en si no me ha funcionado pero me ha dado la pista para crear la función siguiente: &lt;/p&gt;&lt;pre class=&quot;brush: vb;&quot;&gt;        Public Function ConvertToSolidColorBrush(ByVal hexacolor As String) As SolidColorBrush&lt;br /&gt;&lt;br /&gt;            Dim s As String = String.Format(&amp;quot;&amp;lt;SolidColorBrush xmlns=&#39;http://schemas.microsoft.com/client/2007&#39; xmlns:x=&#39;http://schemas.microsoft.com/winfx/2006/xaml&#39; Color=&#39;{0}&#39;&amp;gt;&amp;lt;/SolidColorBrush&amp;gt;&amp;quot;, hexacolor)&lt;br /&gt;            Dim brush As SolidColorBrush = CType(Markup.XamlReader.Load(s), SolidColorBrush)&lt;br /&gt;            Return brush&lt;br /&gt;&lt;br /&gt;       End Function&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Te será realmente útil si al cargar información de configuración.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/1052834418108881129/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/02/my-silverlight-experiences-color.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/1052834418108881129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/1052834418108881129'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/02/my-silverlight-experiences-color.html' title='Silverlight: Convertir un nombre de color predefinido a SolidColorBrush'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-6877307415586833834</id><published>2010-02-09T21:10:00.000+01:00</published><updated>2010-02-09T22:13:48.601+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>¿Cuál es mi IP pública?</title><content type='html'>&lt;p align=&quot;justify&quot;&gt;El otro día estaba desarrollando un pequeño programa para actualizar un nombre de dominio que tengo en el proveedor de &lt;a href=&quot;http://es.wikipedia.org/wiki/Domain_Name_System&quot;&gt;DNS&lt;/a&gt; gratuito de&amp;#160; &lt;a href=&quot;http://www.no-ip.com/&quot;&gt;No-IP&lt;/a&gt; y necesitaba saber mi IP pública. Buscando encontré que la página &lt;a href=&quot;http://www.whatismyip.com/&quot;&gt;What Is My IP&lt;/a&gt; ofrece una página ASP que te ofrece esta información así que he creado la siguiente función:&lt;/p&gt; &lt;pre class=&quot;brush: vb;&quot;&gt;&lt;br /&gt;    Public Function WhatIsMyIP() As String&lt;br /&gt;&lt;br /&gt;        Dim WhatIsMyIPUrl As String = &amp;quot;http://whatismyip.com/automation/n09230945.asp&amp;quot;&lt;br /&gt;        Dim req As HttpWebRequest&lt;br /&gt;        Dim res As HttpWebResponse&lt;br /&gt;        Dim Stream As IO.Stream&lt;br /&gt;        Dim PublicIP As String = String.Empty&lt;br /&gt;        Dim sr As StreamReader&lt;br /&gt;&lt;br /&gt;        Try&lt;br /&gt;            req = WebRequest.Create(WhatIsMyIPUrl)&lt;br /&gt;            res = req.GetResponse()&lt;br /&gt;            Stream = res.GetResponseStream()&lt;br /&gt;            sr = New StreamReader(Stream)&lt;br /&gt;            PublicIP = sr.ReadToEnd()&lt;br /&gt;            sr.Dispose()&lt;br /&gt;        Catch ex As Exception&lt;br /&gt;&lt;br /&gt;        End Try&lt;br /&gt;&lt;br /&gt;        Return PublicIP&lt;br /&gt;&lt;br /&gt;    End Function&lt;br /&gt;&lt;/pre&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/6877307415586833834/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/02/cual-es-mi-ip-publica.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6877307415586833834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6877307415586833834'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/02/cual-es-mi-ip-publica.html' title='¿Cuál es mi IP pública?'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-8745788674677157299</id><published>2010-02-05T21:06:00.008+01:00</published><updated>2010-02-06T12:48:50.559+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Extensión"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><title type='text'>Métodos de extensión para VB.NET</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;¿Habéis utilizado alguna vez los &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/bb384936.aspx&quot;&gt;Métodos de extensión&lt;/a&gt;? Es una de las novedades que incorporaba el ya viejo &lt;a href=&quot;http://www.microsoft.com/spanish/msdn/latam/visualstudio2008/&quot;&gt;Visual Studio 2008&lt;/a&gt; para &lt;a href=&quot;http://dimvisualbasic.blogspot.com/search/label/VB.NET&quot;&gt;VB.NET&lt;/a&gt; pero que te permite añadir funcionalidad a clases ya existentes sin necesidad de tener que usar herencia o polimorfismo. Imagínate que necesitas una función que &quot;limpie&quot; un &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/system.string(VS.80).aspx&quot;&gt;String&lt;/a&gt; y sólo deje los números y elimine letras, signos de puntuación, etc. ¡La típica función para extraer números de matrículas y de NIF!&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;Para implementar dicha funcionalidad normalmente crearíamos una clase que tuviera este método y la iríamos instanciando donde la necesitáramos. Un paso más allá cogeríamos ese método y lo marcaríamos como &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/zc2b427x.aspx&quot;&gt;Shared&lt;/a&gt; para tener así un método de clase y evitar así tener que crear la instancia de la clase para llamarlo.    &lt;br /&gt;
Pues si creamos un método de extensión como este:     &lt;br /&gt;
&lt;/div&gt;&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Imports&lt;/span&gt; System.Runtime.CompilerServices&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Module&lt;/span&gt; Extensions&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &amp;lt;Extension()&amp;gt; _&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt; ExtraerNumeros(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; s &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; out &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;.Empty&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Each&lt;/span&gt; c &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Char&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;In&lt;/span&gt; s&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;             &lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Char&lt;/span&gt;.IsNumber(c) &lt;span style=&quot;color: blue;&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;                 out = &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;.Concat(out, c.ToString())&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;             &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt; out&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Module&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
Podríamos utilizarlo de la siguiente manera: &lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div style=&quot;text-align: auto;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; Numero &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;98732394-Z&quot;&lt;/span&gt;.ExtraerNumeros()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;Ahora cualquier &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/system.string(VS.80).aspx&quot;&gt;String&lt;/a&gt; que tengáis en vuestra aplicación tendrá ese método como propio.&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-decoration: line-through;&quot;&gt;&lt;strong&gt;Nota:&lt;/strong&gt; Si queréis crear un método de extensión que lo puedan utilizar todas las clases sólo tenéis que pasar como referencia un &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/twcxd6b8(VS.80).aspx&quot;&gt;Object&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Haciendo pruebas en &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;a href=&quot;http://www.microsoft.com/spanish/msdn/latam/visualstudio2008/&quot;&gt;Visual Studio 2008&lt;/a&gt;&lt;/span&gt; no he conseguido extender un método contra el tipo Object.&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;Continuará ... &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/8745788674677157299/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/02/metodos-de-extension-para-vbnet.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/8745788674677157299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/8745788674677157299'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2010/02/metodos-de-extension-para-vbnet.html' title='Métodos de extensión para VB.NET'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-5847082139407139790</id><published>2009-12-24T17:23:00.001+01:00</published><updated>2009-12-24T17:23:06.161+01:00</updated><title type='text'>Merry Christmas</title><content type='html'>
&lt;div class=&quot;posterous_bookmarklet_entry&quot;&gt; &lt;object height=&quot;417&quot; width=&quot;500&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/UECBtWLpAyI&amp;hl=en&amp;fs=1&quot; /&gt;&lt;/param&gt;&lt;param name=&quot;wmode&quot; value=&quot;window&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;/param&gt;&lt;embed allowfullscreen=&quot;true&quot; type=&quot;application/x-shockwave-flash&quot; src=&quot;http://www.youtube.com/v/UECBtWLpAyI&amp;hl=en&amp;fs=1&quot; allowscriptaccess=&quot;always&quot; height=&quot;417&quot; wmode=&quot;window&quot; width=&quot;500&quot;&gt;&lt;/embed&gt;&lt;/param&gt;&lt;/object&gt;    &lt;div class=&quot;posterous_quote_citation&quot;&gt;via &lt;a href=&quot;http://www.youtube.com/watch?v=UECBtWLpAyI&amp;amp;feature=email&quot;&gt;youtube.com&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;font-size: 10px;&quot;&gt; &lt;a href=&quot;http://posterous.com&quot;&gt;Posted via web&lt;/a&gt;  from &lt;a href=&quot;http://jordicarrasco.posterous.com/merry-christmas-845&quot;&gt;jordicarrasco&#39;s posterous&lt;/a&gt; &lt;/p&gt;   </content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/5847082139407139790/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/12/merry-christmas.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/5847082139407139790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/5847082139407139790'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/12/merry-christmas.html' title='Merry Christmas'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-9120532114734380932</id><published>2009-12-23T09:00:00.003+01:00</published><updated>2009-12-23T09:07:34.875+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Herencia"/><category scheme="http://www.blogger.com/atom/ns#" term="Reflection"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Obtener las clases derivadas de una clase base</title><content type='html'>&lt;p align=&quot;justify&quot;&gt;&lt;h2&gt;Problemática&lt;/h2&gt;Tenemos un conjunto de clases que heredan todas de la misma clase base y al iniciar el programa necesitamos inicializar y configurar una instancia de cada una de las clases hijas. Hasta ahora cuando necesitábamos definir una clase hija teníamos que:&lt;br /&gt; 1. Crear la nueva clase.&lt;br /&gt; 2. Ir al método que inicializa las clases hijas.&lt;br /&gt; 3. Ir al método donde se configuran las clases hijas.&lt;br /&gt; &lt;br /&gt;¡Un lío! .. y más si tenemos en cuenta que es algo que se hace esporádicamente.&lt;br /&gt;&lt;br /&gt;Nuestro deseo era que cuando alguien necesite implementar la definición de una nueva clase hija simplemente deba hacer eso: definirla y punto, del resto de tareas (inicializar y configurar) que se preocupe el programa.&lt;br /&gt;&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;&lt;h2&gt;Solución&lt;/h2&gt;La solución pasa por usar &lt;a href=&quot;http://dimvisualbasic.blogspot.com/search/label/Reflection&quot; title=&quot;Reflection&quot;&gt;Reflection&lt;/a&gt;. Realizamos una búsqueda en nuestro &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.reflection.assembly.aspx&quot; title=&quot;Assembly&quot;&gt;Assembly&lt;/a&gt; de todas las clases existentes que heredan de la clase base y las instanciamos, ¡Así de fácil!&lt;br /&gt;&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;&lt;h2&gt;Ejemplo&lt;/h2&gt;Primero creamos la clase base y las derivadas:&lt;br /&gt;&lt;pre class=&quot;brush:vb&quot;&gt;&lt;br /&gt;Public MustInherit Class ClaseBase&lt;br /&gt;&lt;br /&gt;    Public MustOverride Sub Metodo()&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;Public Class ClaseQueHerada&lt;br /&gt;    Inherits ClaseBase&lt;br /&gt;&lt;br /&gt;    Public Sub New()&lt;br /&gt;        Console.WriteLine(&quot;Constructor de la ClaseQueHerada&quot;)&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Public Overrides Sub Metodo()&lt;br /&gt;        Console.WriteLine(&quot;ClaseQueHerada.Metodo&quot;)&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;Public Class OtraClaseQueHerada&lt;br /&gt;    Inherits ClaseBase&lt;br /&gt;&lt;br /&gt;    Public Sub New()&lt;br /&gt;        Console.WriteLine(&quot;Constructor de la OtraClaseQueHerada&quot;)&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Public Overrides Sub Metodo()&lt;br /&gt;        Console.WriteLine(&quot;OtraClaseQueHerada.Metodo&quot;)&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;En el código siguiente podemos ver como buscamos las clases derivadas, instanciamos y ejecutamos los métodos comunes y todo en tiempo de ejecución.&lt;br /&gt;&lt;pre class=&quot;brush:vb&quot;&gt;&lt;br /&gt;Module Main&lt;br /&gt;&lt;br /&gt;    Sub Main()&lt;br /&gt;&lt;br /&gt;        &#39;Accedemos al Assembly que estamos ejecutando&lt;br /&gt;        Dim CurrentAssembly As Assembly = System.Reflection.Assembly.GetExecutingAssembly()&lt;br /&gt;        &#39;Con LINQ obtenemos la lista de classes que heredan de ClaseBase, gracias al método IsSubClassOf&lt;br /&gt;        Dim q = From t As Type In CurrentAssembly.GetTypes() _&lt;br /&gt;                Where t.IsSubclassOf(GetType(ClaseBase))&lt;br /&gt;&lt;br /&gt;        For Each o As Type In q&lt;br /&gt;            &#39;Para cada una de las clases hijas la instaciamos y ejecutamos el método&lt;br /&gt;            Console.WriteLine(o.Name)&lt;br /&gt;            Dim der As ClaseBase = CurrentAssembly.CreateInstance(o.FullName, True)&lt;br /&gt;            der.Metodo()&lt;br /&gt;        Next&lt;br /&gt;&lt;br /&gt;        Console.Read()&lt;br /&gt;&lt;br /&gt;    End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;Con este método de acceso a las clases hijas te puedes ahorrar mucho trabajo.</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/9120532114734380932/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/12/obtener-las-clases-derivadas-de-una.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/9120532114734380932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/9120532114734380932'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/12/obtener-las-clases-derivadas-de-una.html' title='Obtener las clases derivadas de una clase base'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-6475038648694101201</id><published>2009-11-26T00:25:00.001+01:00</published><updated>2009-11-26T00:25:13.396+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Curiosidades"/><category scheme="http://www.blogger.com/atom/ns#" term="Freaks"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><title type='text'>Hasta el infinito y más allá: Visual Studio online</title><content type='html'>&lt;p&gt;¿Qué pasa cuando 5 tipos muy freaks se encierran para desarrollar?    &lt;br /&gt;Eso es lo que hicieron la gente de &lt;a href=&quot;http://www.coderun.com/&quot;&gt;CodeRun&lt;/a&gt; y apareció esto:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://www.coderun.com/ide/&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;coderun&quot; border=&quot;0&quot; alt=&quot;coderun&quot; src=&quot;http://lh6.ggpht.com/_t81JinlhjdM/Sw28avsaZbI/AAAAAAAADhk/YOFC-JuQ3sw/coderun%5B17%5D.gif?imgmax=800&quot; width=&quot;660&quot; height=&quot;442&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Estos tipos han desarrollado un ¡&lt;strong&gt;Visual Studio online&lt;/strong&gt;! Todo hecho en Javascript y yo que pensaba que lo había visto todo cuando los de &lt;a href=&quot;http://google.com&quot;&gt;Google&lt;/a&gt; hicieron &lt;a href=&quot;http://mail.google.com/&quot;&gt;&lt;u&gt;Gmail&lt;/u&gt;&lt;/a&gt;. Si alguien tiene 5 minutos para jugar que le un vistazo al &lt;strong&gt;&lt;a href=&quot;http://coderun.com/ide/&quot;&gt;CodeRun Studio&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;  &lt;h2&gt;¿Y para que sirve esto?&lt;/h2&gt;  &lt;p&gt;Imagínate que estas en un lugar sin portátil y necesitas acceder a tu código fuente, realizar una corrección y compilar. Con esta herramienta “podríamos hacerlo” siempre y cuando no utilicemos sistemas de control de versiones, pruebas unitarias, etc.&lt;/p&gt;  &lt;p&gt;La idea está verde aunque se ha realizado ya un trabajo impresionante pero nos da una idea de lo que podremos llevar a ver en la nube.&lt;/p&gt;  &lt;p&gt;Toda la aplicación se ha desarrollado con el &lt;a href=&quot;http://www.coderun.com/cwt/&quot;&gt;CodeRun web Toolkit&lt;/a&gt; sus propias librerías de controles que tienen a la venta y que no están nada mal.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/6475038648694101201/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/11/hasta-el-infinito-y-mas-alla-visual.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6475038648694101201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6475038648694101201'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/11/hasta-el-infinito-y-mas-alla-visual.html' title='Hasta el infinito y más allá: Visual Studio online'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_t81JinlhjdM/Sw28avsaZbI/AAAAAAAADhk/YOFC-JuQ3sw/s72-c/coderun%5B17%5D.gif?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-7830315177311602788</id><published>2009-11-20T20:10:00.001+01:00</published><updated>2009-11-20T22:29:56.072+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>¿Cómo saber el número de registros de una tabla?</title><content type='html'>&lt;p align=&quot;justify&quot;&gt;&lt;br /&gt;Cuando trabajas con SQL Server a veces es necesario consultar cuantos registros tienes en una tabla concreta de la base de datos. Con el script que encontrareis acontinuación obtendreis fácilmente esta infomación.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;SELECT&lt;br /&gt;   [TableName] = so.name,&lt;br /&gt;   [RowCount] = MAX(si.rows)&lt;br /&gt;FROM&lt;br /&gt;   sysobjects so,&lt;br /&gt;   sysindexes si&lt;br /&gt;WHERE&lt;br /&gt;   so.xtype = &#39;U&#39;&lt;br /&gt;   AND&lt;br /&gt;   si.id = OBJECT_ID(so.name)&lt;br /&gt;GROUP BY&lt;br /&gt;   so.name&lt;br /&gt;ORDER BY&lt;br /&gt;   2 DESC&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Visto en &lt;a href=&quot;http://sqlserver2000.databases.aspfaq.com/how-do-i-get-a-list-of-sql-server-tables-and-their-row-counts.html&quot;&gt;How do I get a list of SQL Server tables and their row counts?&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;Si con lo anterior no tienes suficiones el maestro &lt;a href=&quot;http://www.pinaldave.com/&quot;&gt;Pinal Dave&lt;/a&gt; nos enseña como obtener además el número de columnas y el tamaño en bytes de cada una de las tablas.&lt;br /&gt;El script sería así:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;CREATE TABLE #temp (&lt;br /&gt;table_name sysname ,&lt;br /&gt;row_count INT,&lt;br /&gt;reserved_size VARCHAR(50),&lt;br /&gt;data_size VARCHAR(50),&lt;br /&gt;index_size VARCHAR(50),&lt;br /&gt;unused_size VARCHAR(50))&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;INSERT #temp&lt;br /&gt;EXEC sp_msforeachtable &#39;sp_spaceused &#39;&#39;?&#39;&#39;&#39;&lt;br /&gt;SELECT a.table_name,&lt;br /&gt;a.row_count,&lt;br /&gt;COUNT(*) AS col_count,&lt;br /&gt;a.data_size&lt;br /&gt;FROM #temp a&lt;br /&gt;INNER JOIN information_schema.columns b&lt;br /&gt;ON a.table_name collate database_default&lt;br /&gt;= b.table_name collate database_default&lt;br /&gt;GROUP BY a.table_name, a.row_count, a.data_size&lt;br /&gt;ORDER BY CAST(REPLACE(a.data_size, &#39; KB&#39;, &#39;&#39;) AS integer) DESC&lt;br /&gt;DROP TABLE #temp&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Visto en &lt;a href=&quot;http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/&quot;&gt;SQL SERVER - Query to find number Rows, Columns, ByteSize for each table in the current database - Find Biggest Table in Database&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/7830315177311602788/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/11/como-saber-el-numero-de-filas-de-las.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/7830315177311602788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/7830315177311602788'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/11/como-saber-el-numero-de-filas-de-las.html' title='¿Cómo saber el número de registros de una tabla?'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-276944464637944577</id><published>2009-07-21T23:15:00.004+02:00</published><updated>2009-07-21T23:36:17.322+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Serialization"/><category scheme="http://www.blogger.com/atom/ns#" term="Xml"/><title type='text'>Convertir tus objetos en XML directamente</title><content type='html'>&lt;p&gt;
En algunas ocasiones es necesario guardarse un objeto en su estado actual con todas sus propiedades por ejemplo para guardar en un fichero log, o para transferir por algún protocolo que sólo admite texto, etc.    
En casos como estos suele ser muy práctico utilizar las clases de serialización que vienen nativas en el &lt;code&gt;Framework.net&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;
Imaginad que tenemos la típica clase Persona que representa un objeto de negocio de nuestra aplicación:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Class&lt;/span&gt; Persona&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; _Nombre &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; _Apellidos &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt; Nombre() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; _Nombre&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; value &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;            _Nombre = value&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt; Apellidos() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; _Apellidos&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; value &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;            _Apellidos = value&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt;()&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;Me&lt;/span&gt;.Nombre = &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;.Empty&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;Me&lt;/span&gt;.Apellidos = &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;.Empty&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Class&lt;/pre&gt;
&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, &quot;Courier New&quot;, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Para pasar un objeto de esta clase a String necesitamos utilizar las clases &lt;code&gt;System.Xml.Serialization.XmlSerializer&lt;/code&gt; y &lt;code&gt;System.IO.StringWriter&lt;/code&gt; de la siguiente forma: &lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; PersonaSerializada &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Yo &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; Persona()&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;Yo.Nombre = &lt;span class=&quot;str&quot;&gt;&amp;quot;Yo&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;Yo.Apellidos = &lt;span class=&quot;str&quot;&gt;&amp;quot;Mismo&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;Using sw &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; StringWriter()&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; serialitzador &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; XmlSerializer(&lt;span class=&quot;kwrd&quot;&gt;GetType&lt;/span&gt;(Persona))&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    serialitzador.Serialize(sw, Yo)&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    PersonaSerializada = sw.ToString()&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Using&lt;/pre&gt;
&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, &quot;Courier New&quot;, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;Y el resultado que tendríamos sería: &lt;/p&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;utf-16&amp;quot;&lt;/span&gt;?&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Persona&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;xmlns:xsi&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;xmlns:xsd&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Nombre&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Yo&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Nombre&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Apellidos&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Mismo&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Apellidos&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Persona&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, &quot;Courier New&quot;, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;
&lt;/p&gt;&lt;p&gt;
Este es un método práctico y rápido para guardar el estado de un objeto en un momento concreto y puede ser muy útil tanto para poder realizar trazas de un procedimiento concreto o para montar un sistema de gestión de excepciones avanzado .. imaginad que cada vez que se produce una excepción tratando un objeto de negocio nos guardamos la información de la excepción y además el objeto entero.&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;A tener en cuenta:&lt;/strong&gt; &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;El objeto &lt;code&gt;System.Xml.Serialization.XmlSerializer&lt;/code&gt; también incluye el método &lt;code&gt;Deserialize&lt;/code&gt; para cargar el objeto de negocio a partir de un &lt;code&gt;String&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;Si cambiamos las referencias al objeto &lt;code&gt;System.IO.StringWriter&lt;/code&gt; por un &lt;code&gt;System.IO.StreamWriter&lt;/code&gt; podemos guardar el objeto serializado en un fichero XML directamente. &lt;/li&gt;
&lt;li&gt;Los procesos de serialización suelen tener un coste elevado para el sistema así que es conveniente utilizarlo en entornos donde no prime el rendimiento de la aplicación … ¿existe hoy día algún sitio donde no sea imprescindible el rendimiento? .. :-P &lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/276944464637944577/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/07/convertir-tus-objetos-en-xml.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/276944464637944577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/276944464637944577'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/07/convertir-tus-objetos-en-xml.html' title='Convertir tus objetos en XML directamente'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-7088951043457059082</id><published>2009-07-20T23:45:00.001+02:00</published><updated>2009-07-20T23:46:37.575+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Enum"/><category scheme="http://www.blogger.com/atom/ns#" term="Reflection"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Asociar descripción a una Enum</title><content type='html'>&lt;p&gt;Las &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/8h84wky1%28VS.80%29.aspx&quot;&gt;Enum&lt;/a&gt; nos ofrecen la posibilidad de asociar un nombre descriptivo a un conjunto de valores relacionados entre si, estos valores son numéricos. &lt;/p&gt; &lt;pre class=&quot;brush: vb;&quot;&gt;Public Enum EstadoCivil &lt;br /&gt;    Soltero &lt;br /&gt;    Casado &lt;br /&gt;End Enum&lt;/pre&gt; &lt;p&gt;Muchas veces cuando tenemos una &lt;font face=&quot;Courier New&quot;&gt;Enum&lt;/font&gt; tenemos la necesidad de obtener el nombre que le hemos dado a uno de los valores como si fuera un &lt;font face=&quot;Courier New&quot;&gt;String&lt;/font&gt; (pe. “Soltero”) para mostrarlo en un mensaje por pantalla o registrarlo en algún fichero, etc.&lt;/p&gt;&lt;h4&gt;Acceso directo al valor&lt;/h4&gt;&lt;p&gt;Si queremos acceder directamente al literal que le hemos asociado al valor simplemente debemos utilizar el método &lt;font face=&quot;Courier New&quot;&gt;ToString()&lt;/font&gt; del valor:&lt;/p&gt;&lt;pre class=&quot;brush: vb;&quot;&gt;EstadoCivil.Soltero.ToString(&amp;quot;G&amp;quot;)&lt;/pre&gt;&lt;p&gt;Esta línea de código nos devolvería el &lt;font face=&quot;Courier New&quot;&gt;String&lt;/font&gt; “Soltero”. &lt;/p&gt;&lt;h4&gt;Acceder a la descripción detalla del valor&lt;/h4&gt;&lt;p&gt;Si lo que queremos es poder acceder a una información mucho más detallada, deberemos tirar de &lt;font face=&quot;Courier New&quot;&gt;Reflection&lt;/font&gt;. Para empezar deberíamos ampliar la definición de la &lt;font face=&quot;Courier New&quot;&gt;Enum.&lt;/font&gt;&lt;/p&gt;&lt;pre class=&quot;brush: vb;&quot;&gt;Public Enum EstadoCivil&lt;br /&gt; &amp;lt;Description(&amp;quot;Un soltero&amp;quot;)&amp;gt; Soltero&lt;br /&gt; &amp;lt;Description(&amp;quot;Un casado&amp;quot;)&amp;gt; Casado&lt;br /&gt;End Enum&lt;/pre&gt;&lt;p&gt;Y la forma de acceder sería la siguiente:&lt;/p&gt;&lt;pre class=&quot;brush: vb;&quot;&gt;Public Function ObtenerDescripcionEstadoCivil(ByVal estado As EstadoCivil) As String&lt;br /&gt;&lt;br /&gt;    Dim InformacionEstado As FieldInfo = GetType(EstadoCivil).GetField(estado.ToString(&amp;quot;G&amp;quot;))&lt;br /&gt;    Dim Descripcion As DescriptionAttribute = InformacionEstado.GetCustomAttributes(GetType(DescriptionAttribute), False)(0)&lt;br /&gt;&lt;br /&gt;    Return Descripcion.Description&lt;br /&gt;&lt;br /&gt;End Function&lt;/pre&gt;&lt;p&gt;La llamada a esta función nos daría acceso a la descripción que le hemos asignado.&lt;/p&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c7ea5930-683e-4e44-a672-7d4d4846c891&quot; style=&quot;float:none; display:inline; margin:0px; padding:0px 0px 0px 0px;&quot;&gt;Etiquetas de Technorati: &lt;a href=&quot;http://technorati.com/tags/Reflection&quot; rel=&quot;tag&quot;&gt;Reflection&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/VB.NET&quot; rel=&quot;tag&quot;&gt;VB.NET&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/Enum&quot; rel=&quot;tag&quot;&gt;Enum&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/7088951043457059082/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/07/asociar-descripcion-una-enum.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/7088951043457059082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/7088951043457059082'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/07/asociar-descripcion-una-enum.html' title='Asociar descripción a una Enum'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-609806392278301346</id><published>2009-07-18T00:57:00.010+02:00</published><updated>2009-07-19T14:04:51.182+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Refactoring"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Inicialización rápida de objetos</title><content type='html'>&lt;p&gt;Todos sabemos que las instancias de una clase son iniciadas a través de un constructor y que el constructor es un método de la clase que puede ser sobrecargado. Hasta ahí todo correcto, lo de toda la vida.&lt;/p&gt;&lt;h4&gt;Constructores “on fly”&lt;/h4&gt;&lt;p&gt;La versión actual de VB.NET nos permite iniciar las propiedades públicas de una clase en el momento de la instanciación, en la misma línea de código. Imaginaros la siguiente clase:&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:vb&quot; name=&quot;code&quot;&gt;Public Class Persona&lt;br /&gt;&lt;br /&gt;    Private _Nombre As String&lt;br /&gt;    Private _Apellidos As String&lt;br /&gt;&lt;br /&gt;    Public Property Nombre() As String&lt;br /&gt;        Get&lt;br /&gt;            Return _Nombre&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            _Nombre = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    Public Property Apellidos() As String&lt;br /&gt;        Get&lt;br /&gt;            Return _Apellidos&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            _Apellidos = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    Sub New()&lt;br /&gt;        Me.Nombre = String.Empty&lt;br /&gt;        Me.Apellidos = String.Empty&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;End Class&lt;/pre&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;La manera natural de iniciar un objeto de esta clase sería:&lt;/p&gt;&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Dim NuevaPersona As New Persona()&lt;br /&gt;NuevaPersona.Nombre = &amp;quot;Bill&amp;quot;&lt;br /&gt;NuevaPersona.Apellidos = &amp;quot;Gates&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;Si quisiéramos poder crear una persona directamente con su Nombre y Apellidos deberíamos sobrecargar el constructor por defecto para que aceptara estos dos nuevos parámetros.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Con la versión actual de VB.NET y sin tener que implementar el nuevo constructor podemos hacer:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Dim BillGates As New Persona() With {.Nombre = &amp;quot;Bill&amp;quot;, .Apellidos = &amp;quot;Gates&amp;quot;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;¡Este código es equivalente al del ejemplo de antes pero en una sola línea de código! Y si quisiéramos podríamos ir instanciando diferentes objetos con diferentes propiedades configuradas inicialmente:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Dim Bill As New Persona() With {.Nombre = &amp;quot;Bill&amp;quot;}&lt;br /&gt;Dim BillGates As New Persona() With {.Nombre = &amp;quot;Bill&amp;quot;, .Apellidos = &amp;quot;Gates&amp;quot;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Fácil, ¿no?&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/609806392278301346/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/07/inicializacion-rapida-de-objetos.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/609806392278301346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/609806392278301346'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/07/inicializacion-rapida-de-objetos.html' title='Inicialización rápida de objetos'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-7625193098444540980</id><published>2009-06-25T16:44:00.003+02:00</published><updated>2009-07-01T00:04:20.697+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Detectar si la aplicación web está en modo Debug</title><content type='html'>&lt;p&gt;Vía: &lt;a href=&quot;http://www.west-wind.com/Weblog/posts/10228.aspx&quot;&gt;Detecting ASP.NET Debug mode&lt;/a&gt; &lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;No os pasa que cuando estais depurando una aplicación web teneís que introducir siempre los mismo parámetro, pasar los mismo procesos de inicialización, etc. &lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;También es muy útil para generar algunos resultado intermedios que utilizas para ver el estado de la aplicación mientras debugas .. saltarte una pantalla de login, etc. &lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Si eres de los que no soporta hacer mil veces estas tareas aquí tiene la condición mágica: &lt;/p&gt;  &lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;If HttpContext.Current.IsDebuggingEnabled Then&lt;br /&gt;	&#39;Tareas a realizar&lt;br /&gt;End If&lt;/pre&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/7625193098444540980/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/06/detectar-si-la-aplicacion-web-esta-en.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/7625193098444540980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/7625193098444540980'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/06/detectar-si-la-aplicacion-web-esta-en.html' title='Detectar si la aplicación web está en modo Debug'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-6889884632149073747</id><published>2009-03-02T22:50:00.009+01:00</published><updated>2009-12-24T16:55:07.746+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programación asíncrona"/><category scheme="http://www.blogger.com/atom/ns#" term="Threading"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Ejecución de funciones de modo asíncrono</title><content type='html'>&lt;p align=&quot;justify&quot;&gt;&lt;br /&gt;¿Tienes en tu programa una función que tarda muchísimo en ejecutarse y no tienes que hacer nada con el resultado de esta? Por ejemplo en servicios de notificaciones a los que no esperas que te confirmen su recepción, escribir en un fichero de Log, insertar en un registro en una tabla, etc. En general acciones que no tienen que ver con la funcionalidad principal que estamos ejecutando en ese momento.&lt;br /&gt;Si te has encontrado en esta situación .. ¡el esperar se va a acabar! Tenemos los &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/system.delegate%28VS.80%29.aspx&quot;&gt;Delegate&lt;/a&gt;.&lt;br /&gt;Los delegados son básicamente un puntero a un función de tu programa, ¡Tranquilos! No vamos a ver nada de punteros .. no estamos en &lt;a href=&quot;http://es.wikipedia.org/wiki/C_%28lenguaje_de_programaci%C3%B3n%29&quot;&gt;C&lt;/a&gt;. Lo que hace el &lt;a href=&quot;http://www.microsoft.com/downloads/info.aspx?na=40&amp;amp;p=1&amp;amp;SrcDisplayLang=es&amp;amp;SrcCategoryId=&amp;amp;SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&amp;amp;u=http%3a%2f%2fgo.microsoft.com%2ffwlink%2f%3fLinkId%3d53646&quot;&gt;.NET Framework&lt;/a&gt; es ejecutar tu función en otro subproceso de tu aplicación, sin tener que crear Thread.&lt;br /&gt;&lt;br /&gt;Por ejemplo, imaginad que tenemos la siguiente función de nuestro programa:&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;&lt;br /&gt;Private Sub FuncionEjecutadaAsincrona(ByVal parametro1 As String)&lt;br /&gt;&#39;Código pesado del cual no esperamos su respuesta&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Para crear su delegado simplemente tendríamos que definir la así:&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Private Delegate Sub FuncionEjecutadaAsincronaDelegate(ByVal parametro1 As String)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Efectivamente como podéis ver simplemente tenéis que utilizar la misma definición del procedimiento añadiendo la palabra &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/system.delegate%28VS.80%29.aspx&quot;&gt;Delegate&lt;/a&gt;.&lt;br /&gt;Ahora sólo falta llamar a nuestra función que se hará así:&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;&lt;br /&gt;Dim deleg As FuncionEjecutadaAsincronaDelegate&lt;br /&gt;      deleg = New FuncionEjecutadaAsincronaDelegate(AddressOf FuncionEjecutadaAsincrona)&lt;br /&gt;      deleg.BeginInvoke(&quot;Parametro1&quot;, Nothing, Nothing)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;¡Y ya está! Al realizar la llamada a &lt;strong&gt;BeginInvoke&lt;/strong&gt; se lanza nuestra función. Los dos parámetros a Nothing permiten, si es una función, recibir la información de respuesta pero eso lo veremos otro día.&lt;br /&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/6889884632149073747/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/03/ejecucion-de-funciones-de-modo.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6889884632149073747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6889884632149073747'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/03/ejecucion-de-funciones-de-modo.html' title='Ejecución de funciones de modo asíncrono'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-6855890415731665574</id><published>2009-01-17T13:42:00.002+01:00</published><updated>2009-01-17T13:44:48.550+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Code Snippet"/><category scheme="http://www.blogger.com/atom/ns#" term="Patrones de diseño"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>El patrón de diseño Singleton</title><content type='html'>&lt;p align=&quot;justify&quot;&gt;El patrón de diseño Singleton, o de Instancia única, nos permite asegurar que de una determinada clase sólo hay un instancia en todo el sistema.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;La idea es que nuestra clase Singleton no mostrará públicamente las operaciones necesarias para su instanciación (constructor) y por lo tanto será ella quien misma quien gestiones su instanciación.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Imaginaros la típica clase de acceso a la base de datos o a unos datos de configuración o a un sistema de escribir un fichero LOG. Realmente son tareas que realizamos en todos nuestros programas y seguramente lo resolvemos guardando información en variables globales o realizando el proceso de carga o configuración cada vez que lo necesitamos.    &lt;br /&gt;En todos estos casos es muy interesante tener la posibilidad de tener una clase común que nos proporcione acceso a sus recursos pero sin tener que estar instanciando la clase cada vez que la necesitamos.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;La implementación de patrón Singleton en VB.NET sería así:    &lt;br /&gt; &lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Public NotInheritable Class Singleton&lt;br /&gt;&lt;br /&gt;    Private Shared _Instance As Singleton = Nothing&lt;br /&gt;    Private Shared ReadOnly _Sync As New Object&lt;br /&gt;&lt;br /&gt;    Private Sub New()&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Public Shared ReadOnly Property Instance() As Singleton&lt;br /&gt;        Get&lt;br /&gt;            If _Instance Is Nothing Then&lt;br /&gt;                SyncLock _Sync&lt;br /&gt;                    If _Instance Is Nothing Then&lt;br /&gt;                        _Instance = New Singleton()&lt;br /&gt;                    End If&lt;br /&gt;                End SyncLock&lt;br /&gt;            End If&lt;br /&gt;            Return _Instance&lt;br /&gt;        End Get&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;End Class&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Para utilizar la clase que hemos creado simplemente hay que definir una variable de ese objeto y llamar a la propiedad Instance. &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Dim MiSingleton As Singleton = Singleton.Instance&lt;br /&gt;&#39;Ejemplo de llamada de un Metodo de Singleton&lt;br /&gt;MiSingleton.HacerAlgo()&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;Aquí os dejo el fichero &lt;a title=&quot;Singleton.vsi&quot; href=&quot;http://dimvisualbasic.googlepages.com/Singleton.vsi&quot;&gt;Singleton.vsi&lt;/a&gt; que os permitirá incluir en vuestro Visual Studio el code snippet del patrón Singleton.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/6855890415731665574/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/01/el-patrn-de-diseo-singleton.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6855890415731665574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/6855890415731665574'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/01/el-patrn-de-diseo-singleton.html' title='El patrón de diseño Singleton'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-1488544094749022237</id><published>2009-01-13T21:08:00.002+01:00</published><updated>2009-01-13T21:42:18.272+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Excepciones"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Gestión global de excepciones</title><content type='html'>&lt;p&gt;&lt;a title=&quot;Software bug 04&quot; href=&quot;http://www.flickr.com/photos/11867110@N00/362411276/&quot;&gt;&lt;img alt=&quot;Software bug 04&quot; src=&quot;http://static.flickr.com/129/362411276_e42041ecca.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Aunque cada vez el software que desarrollamos es más robusto la verdad es que nadie se escapa de dejar algún gazapo que en cualquier momento se le presentará al usuario final en forma de un horrible mensaje de error. &lt;/p&gt; &lt;p&gt;Si queremos evitar estas situaciones podemos definir los eventos &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx&quot;&gt;UnhandledException&lt;/a&gt; y &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx&quot;&gt;ThreadException&lt;/a&gt; en nuestros programa y problema resuelto. La verdad es que no parece demasiado lógico que tengamos que definir dos eventos para capturar las excepciones que no controlamos pero el primero se encarga de manejar las que no tienen que ver con el interface gráfico y el segundo se encarga de las visuales.&lt;/p&gt; &lt;p&gt;La implementación sería de la siguiente manera:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Definición de los eventos:     &lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;Private Sub Form1_Load(ByVal sender As System.Object, _&lt;br /&gt;                       ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;&lt;br /&gt;    Dim currentDomain As AppDomain = AppDomain.CurrentDomain &lt;br /&gt;    AddHandler currentDomain.UnhandledException, AddressOf AppDomain_UnhandledException&lt;br /&gt;    AddHandler Application.ThreadException, AddressOf Application_ThreadException&lt;br /&gt;&lt;br /&gt;End Sub&lt;/pre&gt;&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Declaración del evento que maneja la &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx&quot;&gt;UnhandledException&lt;/a&gt;:&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;&lt;br /&gt;Private Sub AppDomain_UnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)&lt;br /&gt;&lt;br /&gt;Dim st As New StackTrace()&lt;br /&gt;Dim pila As String = st.ToString() &#39;Obtenemos el estado actual de la pila&lt;br /&gt;&lt;br /&gt;Dim ex As Exception = DirectCast(e.ExceptionObject, Exception)&lt;br /&gt;&lt;br /&gt;&#39;Acciones a realizar para registrar las excepciones&lt;br /&gt;MessageBox.Show(&quot;UnhandledException&quot; &amp; ex.Message)&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Declaración del evento que maneja la &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx&quot;&gt;ThreadException&lt;/a&gt;:&lt;br /&gt;&lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;&lt;br /&gt;Private Sub Application_ThreadException(ByVal sender As Object, ByVal e As Threading.ThreadExceptionEventArgs)&lt;br /&gt;&lt;br /&gt;Dim st As New StackTrace()&lt;br /&gt;Dim pila As String = st.ToString()&lt;br /&gt;&lt;br /&gt;&#39;Acciones a realizar para registrar las excepciones&lt;br /&gt;MessageBox.Show(&quot;ThreadException&quot; &amp; e.Exception.Message &amp; &quot;. &quot; &amp; pila)&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;p&gt;¡Y eso es todo! Ahora ya no hay excusa para no facilitarle el trabajo al usuario final mostrándole esos feos mensajes de error y además nos permitirá registrar toda la información existente en el sistema en el momento que se lanzó la excepción.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/1488544094749022237/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/01/gestin-global-de-excepciones.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/1488544094749022237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/1488544094749022237'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2009/01/gestin-global-de-excepciones.html' title='Gestión global de excepciones'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-4570526837846051015</id><published>2008-12-07T11:28:00.006+01:00</published><updated>2009-01-12T23:01:18.983+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Optimización"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>La función Replace de Microsoft.VisualBasic</title><content type='html'>&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2c5665ee-1f7a-4b84-8698-40a27bbb5591&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;Etiquetas de Technorati: &lt;a href=&quot;http://technorati.com/tags/VB.NET&quot; rel=&quot;tag&quot;&gt;VB.NET&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/Optimizaci%c3%b3n&quot; rel=&quot;tag&quot;&gt;Optimizaci&amp;#243;n&lt;/a&gt;&lt;/div&gt;  &lt;p align=&quot;justify&quot;&gt;Muchos de los que ahora programamos en VB.NET venimos del viejo mundo del VB6, ese mundo de caos donde no existía la orientación a objetos y para muchas cosas tenias que tirar de la API de Windows.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Ahora que utilizamos VB.NET nuestro mundo se ha simplificado mucho pero tenemos que ir con cuidado ¡sin darnos cuenta vamos y volvemos al lado oscuro! Ya que dentro del framework existe la librería Microsoft.VisualBasic.dll que es un vínculo que nos han dejado los desarrolladores de Microsoft para que la transición fuera menos traumática.    &lt;br /&gt;El problema es que ese vínculo que nos dejaron con el pasado afecta directamente contra el rendimiento de nuestras aplicaciones. Un ejemplo claro de sería la función &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/bt3szac5%28VS.80%29.aspx&quot;&gt;Replace&lt;/a&gt;.&lt;/p&gt;  &lt;pre class=&quot;vb&quot; name=&quot;code&quot;&gt;&lt;br /&gt;Dim str As String = &amp;quot;ABA&amp;quot;&lt;br /&gt;str = Replace(str, &amp;quot;A&amp;quot;, &amp;quot;X&amp;quot;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Cuando utilizamos la función &lt;a href=&quot;http://msdn.microsoft.com/es-es/library/bt3szac5%28VS.80%29.aspx&quot;&gt;Replace&lt;/a&gt;, estamos llamando la función que hay en la librería Microsoft.VisualBasic, denominada Strings.Replace.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Si decompilamos esta función, con &lt;a href=&quot;http://www.red-gate.com/products/reflector/&quot;&gt;.NET Reflector&lt;/a&gt;, vemos que realmente se llama a la siguiente función:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; background-color: rgb(244,244,244)&quot;&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Shared&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Function&lt;/span&gt; Replace(&lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Expression &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Find &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Replacement &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Optional&lt;/span&gt; Start &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt; = 1, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Optional&lt;/span&gt; Count &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt; = -1, &amp;lt;OptionCompare&amp;gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Optional&lt;/span&gt; [Compare] &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; CompareMethod = 0) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   2:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; str &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Try&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   4:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (Count &amp;lt; -1) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   5:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Throw&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;New&lt;/span&gt; ArgumentException(Utils.GetResourceString(&lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;Argument_GEMinusOne1&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;New&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;() { &lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;Count&amp;quot;&lt;/span&gt; }))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   6:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   7:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (Start &amp;lt;= 0) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   8:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Throw&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;New&lt;/span&gt; ArgumentException(Utils.GetResourceString(&lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;Argument_GTZero1&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;New&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;() { &lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;Start&amp;quot;&lt;/span&gt; }))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   9:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  10:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; ((Expression &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Is&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Nothing&lt;/span&gt;) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;OrElse&lt;/span&gt; (Start &amp;gt; Expression.Length)) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  11:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Return&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Nothing&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  12:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  13:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (Start &amp;lt;&amp;gt; 1) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  14:&lt;/span&gt;             Expression = Expression.Substring((Start - 1))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  15:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  16:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (Find &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Is&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Nothing&lt;/span&gt;) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  17:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Return&lt;/span&gt; Expression&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  18:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  19:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; ((Find.Length = 0) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;OrElse&lt;/span&gt; (Count = 0)) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  20:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Return&lt;/span&gt; Expression&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  21:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  22:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (Count = -1) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  23:&lt;/span&gt;             Count = Expression.Length&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  24:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  25:&lt;/span&gt;         str = Strings.ReplaceInternal(Expression, Find, Replacement, Count, [Compare])&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  26:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Catch&lt;/span&gt; exception &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; Exception&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  27:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Throw&lt;/span&gt; exception&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  28:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Try&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  29:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Return&lt;/span&gt; str&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  30:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Esta a su vez llama a :&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; background-color: rgb(244,244,244)&quot;&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Shared&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Function&lt;/span&gt; ReplaceInternal(&lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Expression &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Find &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Replacement &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; Count &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ByVal&lt;/span&gt; [Compare] &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; CompareMethod) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   2:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; ordinal &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; CompareOptions&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; compareInfo &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; CompareInfo&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; num5 &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; length &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt; = Expression.Length&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; num2 &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt; = Find.Length&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; builder &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;New&lt;/span&gt; StringBuilder(length)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; ([Compare] = CompareMethod.Text) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   9:&lt;/span&gt;         compareInfo = Utils.GetCultureInfo.CompareInfo&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  10:&lt;/span&gt;         ordinal = (CompareOptions.IgnoreWidth &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Or&lt;/span&gt; (CompareOptions.IgnoreKanaType &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Or&lt;/span&gt; CompareOptions.IgnoreCase))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  11:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Else&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  12:&lt;/span&gt;         compareInfo = Strings.m_InvariantCompareInfo&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  13:&lt;/span&gt;         ordinal = CompareOptions.Ordinal&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  14:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  15:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Do&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;While&lt;/span&gt; (num5 &amp;lt; length)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  16:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; num4 &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  17:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (num4 = Count) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  18:&lt;/span&gt;             builder.Append(Expression.Substring(num5))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  19:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Exit&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Do&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  20:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  21:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; num3 &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Integer&lt;/span&gt; = compareInfo.IndexOf(Expression, Find, num5, ordinal)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  22:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt; (num3 &amp;lt; 0) &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  23:&lt;/span&gt;             builder.Append(Expression.Substring(num5))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  24:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Exit&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Do&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  25:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  26:&lt;/span&gt;         builder.Append(Expression.Substring(num5, (num3 - num5)))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  27:&lt;/span&gt;         builder.Append(Replacement)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  28:&lt;/span&gt;         num4 += 1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  29:&lt;/span&gt;         num5 = (num3 + num2)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  30:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Loop&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  31:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Return&lt;/span&gt; builder.ToString&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;  32:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Conclusión&lt;/strong&gt;: &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Cuando hacemos un &lt;strong&gt;Replace&lt;/strong&gt; realmente estamos creando un &lt;strong&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.aspx&quot;&gt;StringBuilder&lt;/a&gt;&lt;/strong&gt; y ejecutando un bucle While. Increible, ¿no?&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Solución: &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Normalmente cuando utilizamos esta función es para realizar un reemplazo de todas la coincidencia y no utilizamos la mayoría de opciones de ofrece la función &lt;strong&gt;Replace&lt;/strong&gt;. Yo me simplifico la vida y utilizo la que viene nativa con el tipo String.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; background-color: rgb(244,244,244)&quot;&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;Dim&lt;/span&gt; str &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;ABA&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: rgb(244,244,244); border-bottom-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot;&gt;   2:&lt;/span&gt; str = str.Replace(&lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0,96,128)&quot;&gt;&amp;quot;X&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;That&#39;s it!&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/4570526837846051015/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2008/12/la-funcin-replace-de.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/4570526837846051015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/4570526837846051015'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2008/12/la-funcin-replace-de.html' title='La función Replace de Microsoft.VisualBasic'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-431738679124133696.post-150967701025337531</id><published>2008-11-30T21:03:00.000+01:00</published><updated>2008-11-30T21:07:13.348+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Optimización"/><title type='text'>Las reglas de la optimización son sencillas. Regla 1: No optimices. Regla 2 (solo para expertos): No optimices todavía.</title><content type='html'>&lt;p align=&quot;justify&quot;&gt;Cuantas veces estamos delante de un programa, creando una funci&amp;#243;n y de repente nos desviamos de nuestro objetivo principal para emprender una cruzada para reducir el tiempo de procesamiento e intentar lograr que esa funci&amp;#243;n o procedimiento se ejecuto lo m&amp;#225;s r&amp;#225;pido posible.    &lt;br /&gt;Seguramente esta situaci&amp;#243;n nos la encontramos m&amp;#225;s veces de las que deseamos.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Este proceso se denomina &lt;a href=&quot;http://es.wikipedia.org/wiki/Premature_optimization&quot;&gt;optimizaci&amp;#243;n prematura&lt;/a&gt; y se produce cuando el programador permite que las consideraciones&lt;a title=&quot;Stop ! Right now !&quot; href=&quot;http://www.flickr.com/photos/77922700@N00/145211107/&quot;&gt;&lt;img height=&quot;171&quot; alt=&quot;Stop ! Right now !&quot; src=&quot;http://static.flickr.com/44/145211107_f2020ec804_m.jpg&quot; width=&quot;248&quot; align=&quot;right&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;s de reducci&amp;#243;n del tiempo o espacio afectan al dise&amp;#241;o inicial. &lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Normalmente las decisiones de optimizaci&amp;#243;n en la etapa de codificaci&amp;#243;n son subjetivas, b&amp;#225;sicamente se basan en las sensaciones que el programador tiene durante esta fase y no en datos emp&amp;#237;ricos.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Antes de iniciar un proceso de optimizaci&amp;#243;n del c&amp;#243;digo fuente os recomiendo:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;div align=&quot;justify&quot;&gt;Asegurarse que sigue el dise&amp;#241;o preestablecido en las etapas anteriores.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align=&quot;justify&quot;&gt;Crear una bater&amp;#237;a de pruebas que nos permita confirmar que cumple todas las funcionalidades acordadas en el an&amp;#225;lisis funcional.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align=&quot;justify&quot;&gt;No optimices.&lt;/div&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p align=&quot;justify&quot;&gt;Las optimizaciones de c&amp;#243;digo se deben hacer siempre despu&amp;#233;s de que este se haya finalizado y probado correctamente certificando as&amp;#237; que cumple las especificaciones funcionales establecidas en las etapas previas.    &lt;br /&gt;Es preferible no optimizar hasta que realmente lo necesitemos, en ese momento se deber&amp;#225; estudiar d&amp;#243;nde y c&amp;#243;mo optimizar ya que no todo depende de nuestro c&amp;#243;digo fuente y pueden existir recursos externos se deban tener en cuenta.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dimvisualbasic.blogspot.com/feeds/150967701025337531/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://dimvisualbasic.blogspot.com/2008/11/las-reglas-de-la-optimizacin-son.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/150967701025337531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/431738679124133696/posts/default/150967701025337531'/><link rel='alternate' type='text/html' href='http://dimvisualbasic.blogspot.com/2008/11/las-reglas-de-la-optimizacin-son.html' title='Las reglas de la optimización son sencillas. Regla 1: No optimices. Regla 2 (solo para expertos): No optimices todavía.'/><author><name>Jordi</name><uri>http://www.blogger.com/profile/11555613778947614735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh87q-9tzgbtAxcp6mGfLxypbDbtwAuHGytmlhdMh7FmuS4bn45vuQDXK1uEdk8SeeqnlBuykUPDd5t6q_HrTy10g36LVykQbxOgj-FLAzNdNB4qOLrVB1cyOE2iaUmvA/s220/mypictr_last.fm.jpg'/></author><thr:total>0</thr:total></entry></feed>