How To Convert C# Keyword Yield

Nov 9, 2011

Possible Duplicates: Translation of yield into VB.NETYield In VB.NETI try to convert the C# yield to VB.NET but i found there is no yield in VB.NET

View 1 Replies


ADVERTISEMENT

Does VB In Visual Studio 2010 Include The YIELD Keyword (yield Return, Yield Break)

Sep 29, 2009

Will Visual Basic in Visual Studio 2010 have the YIELD keyword?If not.... Why?

View 1 Replies

VS 2010 - Alternative To YIELD Keyword In VB

Apr 19, 2011

I have a tricky piece of code in C# that I need translated to VB.NET. That's not usually a problem, as I can do it by hand or using one of the many conversion websites. However, this particular piece of code uses the Yield keyword; and I don't know how to work around that. [Code]

View 10 Replies

C# - Way To Implement Caliburn-like Co-routines In Since There's No Yield Keyword?

Mar 26, 2010

Note that I'm aware of other yield in vb.net questions here on SO. I'm playing around with Caliburn lately. Bunch of great stuff there, including co-routines implementation.

Most of the work I'm doing is C# based, but now I'm also creating an architecture guideline for a VB.NET only shop, based on Rob's small MVVM framework.Everything looks very well except using co-routines from VB. Since VB 10 is used, we can try something like Bill McCarthy's suggestion:

[Code]...

It definitely isn't as elegant as C# version, but it looks to be doable. We'll see if there are any problems with this. If anyone has better idea, I'm all ears.

View 1 Replies

C# - Translation Of Yield Into .NET?

Sep 28, 2010

What is the best/easiest way to "translate" it into VB.NET? Especially i tried to convert this code into VB.NET, but i failed with:

yield return new MatchNode(++index, current.Value);

What i have is:

Imports System.Collections
Imports System.Data.SqlTypes
Imports System.Diagnostics.CodeAnalysis

[code]....

View 5 Replies

.net - Identical If() And If Yield Different Results

Dec 22, 2010

What is the difference in the two blocks of code below? I expected them to return the same result, but they don't.

In the case where xml.@Type = "null", I want PatientMetricTypeID (a nullable Integer) to end up being Nothing.

Block #1: If()

In this case, it ends up as 0. It looks like Nothing is being treated as an Integer and converted to 0. I can sort of see why this might happen but not fully... I would like to understand exactly how this works, and if there is a workaround.

Dim PatientMetricTypeID As Integer? = If(xml.@Type = "null",
Nothing,
CType([Enum].Parse(GetType(PatientMetricTypes), xml.@Type), Integer))

Block #2: If

In this case, it ends up as Nothing -- expected behavior.

Dim PatientMetricTypeID As Integer?

If xml.@Type = "null" Then

[CODE]...

View 3 Replies

VS 2010 C# Yield Return In VB?

Feb 2, 2011

I'm converting some C# code and I'm stuck at this line:c# while (iterator.MoveNext()) yield return iterator.Current;

View 4 Replies

Null String Yield An Error

Sep 10, 2009

I have the following code below which has an error. When the checkbox is set to true and for example change the "role", and click save the following error is given;

"Index was outside the bonds of the array".

I know the reason of the error but don't know the solution..

The TxtPayCont is a concatenation of title, fname, and lname in an array. Therefore, if all the fields have values, then it works fine. So if it is Mr Jones Tim, this works, but, if it is Mr Jones it does not. It has to have 2 spaces to work. Is there anyway round this...

(see code below)..

Code:

View 1 Replies

Implement Yield Return For IEnumerable Functions?

May 17, 2009

In C#, when writing a function that returns an IEnumerble<>, you can use yield return to return a single item of the enumeration and yield break; to signify no remaining items. What is the VB.NET syntax for doing the same thing?

[Code]...

View 6 Replies

.net - Yield/Sleep/throttle Another Thread While It Is Executing A Method In An External Library - Specifically Jurassic?

Jun 25, 2012

I am using a .Net JavaScript implementation called Jurassic to run user-controlled scripts within my .Net 4 WPF application coded in VB.Net - C# answers are fine. The script engine runs on its own thread and provides an API for the script to interact with my application. This all works really nicely until a user executes a script that causes an infinite loop and takes out a core of the processor.

[Code]...

The reason I care about keeping the thread alive is because the user who wrote the script and the user who is running it may not be the same, and I want to keep the experience as smooth as possible the the user running the thread. There also might be legitimate situations in which a single JavaScript function would run for a long time and I do not want to kill that, I just want to stop being allowed to hog the resources.

Solutions that involve stopping the thread from slowing down the system but that still show high CPU usage are not preferable because I do not want the user to wrongly feel that the application is resource intensive.

View 1 Replies

DataGrid Columns Math - Result Return The Answer In The Unbound Yield Column For That Row Represented As A Percentage?

Sep 20, 2010

I have a table in a data grid the columns are bound to the columns...

SQFT QTY WIDTH LENGTH

i also have added into the datagrid an unbound column called Yeild%.what i'm trying to do is the following formula

SQFT / (QTY * (width * length / 144) and have the result return the answer in the unbound yield column for that row represented as a percentage

So if SQFT = 178 QTY = 2 Width = 144 Length = 102 answer would be 0.87 (rounded)

so this would be 87%

View 7 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

Converting C# Program To VB - Use "Yield" Statement ?

Feb 23, 2012

I am converting C# program to VB. I heard that "Yield" statement is ready from Visual Studio 2010 SP1.

[URL]

I updated my developing environment to Visual Studio 2010 SP1. However IDE still displays error to the following code saying that "yield" is not delclared.

Public Class WeakCollection(Of T)

Implements IEnumerable(Of T)...

ReadOnly innerList As List(Of WeakReference) = New List(Of WeakReference)()

[CODE]...

How can I use "Yield" statement in VB?

View 3 Replies

.net - Does C# Have A Handles Keyword

May 25, 2011

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
End Sub

In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?

View 5 Replies

C# - .Net's With Keyword In Java?

Jun 6, 2011

Possible Duplicate: WITH statement in Java? does anyone know if there is the With Keyword in Java?

View 4 Replies

C# - Namespace And Use Keyword

Jul 13, 2010

why use of namespace and use keyword and declaration of namespace

View 1 Replies

C# To Vb: The **default** Keyword?

May 7, 2011

Possible Duplicate:Default value for generics k so while translating some code from c# to vb, i came across the default keyword, and I'm simply replacing it to nothing.

View 2 Replies

Extended With-keyword In .NET?

Oct 29, 2010

In my current project everyone names variables and methods after what they are and what they do. This is good for quickly understanding the code, but with a lot of long varible names comes some headaches, such as when copying a dataset to an entity/object. So, while you understand the code, the readability still takes a blow.

veryLongVariableName.Id = datasetVeryLongVariableName.Id
veryLongVariablename.Something = datasetVeryLongVariableName.Something
etc.

Using VB.NET's With keyword can help.

With veryLongVariableName
.Id = datasetVeryLongVariableName.Id
.Something = datasetVeryLongVariableName.Something
End With

Now, my question, is there any way of using With, or something similar, but for several variables at the same time? Something like:

With veryLongVariableName As a, datasetVeryLongVariableName as b
a.Id = b.Id
a.Something = b.Something
End With

I'm all for descriptive naming conventions, but they do tend to clutter things. Especially in VB!

View 3 Replies

How To Search A Keyword

Oct 26, 2009

I m trying to create a software in vb.net for some genealogists to trace their ancestors History, the users will search for the document in 3 ways

1. reference number from a combo box.
2. By the title of the document.
3. by inserting a keyword from the documents abstract..

i have already loaded the picture. i hav put all in one note pad my reference no., on next line i put my abstract and on the third line i put my path where the document is located.in coding i put all in different array.... making the program read all one by one line wise.i want to make search thru the keyword... means wen user inserts a key word in the textbox the program read all my abstract and then in a drop down it should display the documents that match the keyword.

View 6 Replies

New Keyword But Still Gives Error

May 17, 2012

Its work well in windows 7 but when i run project in windows xp its says i must use New keyword but when i use New its gives error at regkey.GetValueNames and RegistryKey = Registry.LocalMachine and regBaseKey.OpenSubKey("SOFTWAREMyApp", FalseImports Microsoft.Win32[code]...

View 4 Replies

Reserved Keyword In .net?

Mar 13, 2012

in C# you'd put a @ in front of a reserved keyword. Is there any equivalent in vb .net?

View 1 Replies

Use A Keyword As A Propertyname?

May 3, 2011

I have to serialize/deserialize a class into a JSON string/and return. The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.

How can i implement a class like:

[code]...

If i do this, the word 'error' is invalid.

View 2 Replies

Use Call Keyword In VB / VBA?

Apr 4, 2010

I use the Call keyword when calling subs in VB/VBA. I know it's optional, but is it better to use it or leave it off? I've always thought it was more explicit, but maybe it's just noise. Also, I read this on another forum: Using the Call keyword is faster because it knows that it is not going to return any values, so it doesn't need to set up any stackspace to make room for the return value.

View 4 Replies

VS 2010 Use Of NEW Keyword?

Dec 1, 2011

First off let me say that I am essentially new to VB.NET, i.e; still learning. Also, I hope that this is the right place to post this question. In a Project I have a Class module defined as:

Public Class Def
Public Id As String
Public Meaning As String

[Code]...

View 2 Replies

.net - Global Keyword In VB 2005?

Jul 1, 2009

I have to inherit some legacy code in company, which is written in Visual Basic.NET 7.0 (Visual Studio.NET 2002). I don't have much experiences in VB.NET, and this line of code gets me in trouble:

Public Class Global : Inherits System.Web.HttpApplication

Visual Studio gave this error: Error 31Keyword is not valid as an identifier.C:Documents and SettingsAdministratorDesktopPOManWebApplication1Global.asax.vb414C:...POMan

View 2 Replies

Asp.net - What Is Keyword If Page.IsPostBack How Can Use It

May 11, 2011

What is this keyword how can use it?If Page.IsPostBack = False Then

View 3 Replies

C# - Region Keyword In Functions

Nov 1, 2011

I generally use to organize codes below lines;

#Region "Comments.."
#End Region

But when I want to use it in the Function, it gives error ("..are not valid within..."). Are there any keyword to make this in the Function or there aren't? [Code]

View 3 Replies

C# - Region Keyword In Functions?

Feb 17, 2010

I generally use to organize codes below lines;#Region "Comments.."#End RegionBut when I want to use it in the Function, it gives error ("..are not valid within...").

View 2 Replies

Capture The Keyword From The Log File?

Aug 26, 2011

I'm still new in VB.net development environment, i've few of the question may need the advice from you guys to see whether i'm in the right track for the development as below condition:Basically my program wrote from this logics:

Condition:

2 log files available in C drive that is C:/BSKYB/Prod.txt

and C:/BSKYB_CWE/many of log files in .txt format

Program Flow:

Step 1: The program will read the last sentence Hexa number from the file "Prod.txt"

Step 2: Once the program detecting the keyword like example "abcde" it will go to another folder which is descript in C:/BSKYB_CWE to look at which text files contains the keyword "abcde"

Step 3: this step will capture the whole line the text info like example 1111 abcde

if in this case, once the abcde detected what is the command i should apply to capture the key word 1111 ?

This is the problem i have encounter right now, i doesn't know how is actually can apply the right method to read the whole text line once the key word is detected

Public Class Form1
' Const ConstBSKYB = "C:BSKYB_CWE.txt "
'Const ConstBSKYBP = "C:BSKYBProd.txt"[code].....

View 2 Replies

Equivalent Keyword For App.path

Apr 11, 2010

We have a keyword 'app.path' in VB6 What is the equivalent key word in VB.NET

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved