MyClass keyword understanding
- What .NET Developers Must Know about C++ Classes
- Chapter 4. Classes and Objects
- MyClass equivalent in C#
- Me, My, MyBase, and MyClass in Visual Basic
- Comparison of C Sharp and Visual Basic .NET
- C# equivalent of the vb isNothing
- What is the C# equivalent to VB's Handles?
- What is the C# equivalent to the VB Left function and right function?
- What is the C# equivalent to VB's InStr?
- IndexOf(int, string, string) … This returns the offset of the first match after the integer value.
- IndexOf(string,string) … This returns the offset of the string.
- LastIndexOf(string,string) … This returns the last offset of your search value.
- What is the C# equivalent of with in VB.NET?
- What is the new keyword for in this C# code?
- What is the C# equivalent to VB's exit sub?
- What is the C# equivalent to VB's friend?
- Me, MyBase and MyClass…
- C# Equivalent of VB.NET MyClass???
- What's difference between f(const MyClass & in) and f(MyClass in)
- The equivalent of Global constants in VB
- C# equivalent of VB.NET Redim Preserve
- Me vs. MyClass
- translate static in C# to VB.NET
- VB.Net program to demonstrate the 'MyClass' keyword
- Curious case of typeof in C# and VB.NET
- With End Block - VB.Net
- The My namespace
- Extending the My namespace
- Distinguishing Visual Basic Me, My, MyBase, and MyClass
- Use Shared Keyword In VB.NET
- Transformation In GDI+ In VB.NET
- GDI+ IN VB.NET ARTICLES
Must Read
C++ does things differently than C# or Visual Basic, especially when it comes to class construction. Take this tour to learn about the differences.
Chapter 3 discussed the myriad primitive types built into the C# language, such as int, long, and char. The heart and soul of C#, however, is the ability to create new, complex, programmer-defined types that map cleanly to the objects that make up the problem you are trying to solve.
More Details
In looking at this question, commenter @Jon Egerton mentioned that MyClass was a keyword in VB.Net. Having never used it, I went and found the documentation on it:
I can see how that could kind of be useful, in some specific scenarios. What I can't think of is, how would you obtain the same behaviour in C# - that is, to ensure that a call to a virtual method myMethod is actually invoked against myMethod in the current class, and not a derived myMethod (a.k.a in the IL, invoking call rather than callvirt)?
Me, My, MyBase, and MyClass in Visual Basic have similar names, but different purposes. This topic describes each of these entities in order to distinguish them.
C# and Visual Basic .NET are the two primary languages used to program on the .NET Framework.
VB.Net IsNothing Function returns a Boolean value indicating whether an expression has no object assigned to it. There is no direct, 100% equivalent of the Vb.Net function IsNothing, but the test against null accomplishes the same thing.
IsNothing is intended to work on reference types. It returns True if the expression represents an object variable that currently has no object assigned to it; otherwise, it returns False.
The null keyword is specific design feature in the C# language. It is a literal that represents a null reference, one that does not refer to any object. null is the default value of reference-type variables
I assume you mean for handling an event here. There are other Handles such as when discussing Windows API … Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub
What is the C# equivalent to VB's friend?
Assembly level class member visibility in C# is ‘internal' I believe.
The Right function doesn’t exist in C#. However, you can create one, as well as a Left and a mid and make them work just like they do in VB.
What you need to use is the SubString command and counters that dictate where to start and stop in a string of text. just remember to trap for errors such as the user sending values that would exceed the length of the string or trying to use negative numbers. Remember, Users are stupid.
You can use
Q:What is the C# equivalent of with in VB Dot thing
A: Hmmm…….. I will assume the correct question is:
What is the C# equivalent of “With” in VB dot thing?
This is an Anonymous Type. Well, not truly anonymous, the compiler will assign an auto generated name for such class. It's said to be anonymous because the developer does not have to bother to give such class a name because the compiler will automatically create a random one.
in C# return;
Assembly level class member visibility in C# is ‘internal' I believe.
Me is what really symbolizes VB.NET isn’t it? Where is it really applicable ? Lets see:
Many good examples...
In otherwords, how do I force a method in my class to call the method implementations in the SAME class and not use any potentially overriden methods in derived classes?
but can anyone tell me how to simulate the concept of a global constant in a C# Windows app? The app in question contains several forms, each of which need to interrogate the value of a "global" constant. Do I have to create a class with a public constant declaration and instantiate that class from each form?
Does C# have an equivalent for VB.NET's Redim Preserve ? ReDim Preserve increases the final dimension of any array while preserving the array's contents (however, the type of the array may not be changed).
What is the difference between the Me and the MyClass keywords? I understand Me that it represents the specific instance of the class. When you're inside the object instance, it refers to itself using the Me keyword. What is the MyClass keyword used for?
very good examples
Here, we will demonstrate the MyClass keyword. The MyClass keyword is used to refer to the current class name.
In this article one of the operator keyword which every .NET developer encounters named as typeof. But the purpose it servers in both of the languages is different.
If you are the curious one to know how C# and vb.net treats typeof, continue reading the article.
There is no direct equivalent to this in C#
One of the great new feature in Visual Basic 2005 is the My namespace.
The My namespace doesn’t bring anything new to the language. It simply offers a clearer path to methods and properties already existing in the .Net Framework. You can see it as a shortcut to quickly access features that are sometime hard to find.
This is the first article of a series of 2. Next month, I will show you how to extend this namespace with your own methods.
This is the second (and last) article on the My namespace. Last month, I showed you what is the My namespace and how to use it. This month, I will show you how to extend it with your own methods. As you will soon discover, it is as simple as adding 2 lines to a class that you might already have written.
Why extend this class? You surely built many helper functions over the years. Most of those functions are probably declared as static so that you don’t have to create an instance of the class to use them.
The good news is that the My namespace can be extended so that your own classes can sit beside My.Application, My.Computer, My.User and so on.
I have been providing C# code for my articles for a long time now but not this month. The reason is that MyClass has no equivalent in that language. MyClass is purely VB.
The easy one: My Let’s start with the easy one: My. The My keyword was introduced in the VB language with the .Net Framework 2.0 (TODO) and is simply a shortcut to often used .Net Framework classes. I have already covered this keyword in June 2007.
The obvious one: Me This is the most often used keyword even if you don’t even always write it yourself because it is implicit from within an instance. In theory, the Me keyword is used to access the current instance.
The common one: MyBase Sometimes, you don’t want to access to the current instance but you would prefer to refer to the base instance when you have overridden or shadowed a member. We very often see this keyword in constructors. We want to do everything the base constructor is doing and add something specific to the current instance in the derived class.
Notice that if your classes inherits many levels deep, MyBase will call the members of the immediate base class (the one just above) and won’t go until the root.
The obscure one: MyClass MyClass behaves mostly like Me. The only exception is that it will force to use the current instance of the class (and not any of its overrides) as if the members were declared as NotOverridable. In other words, MyClass makes sure that the member of the current class is dispatched and not the overridden member.
Shared keyword A shared method is not accessed via an object instance like a regular method, but rather is accessed directly from the class. The shared keyword in VB.NET is the equivalent of the static keyword in C#. In VB.NET, the shared keyword can only be applied to methods within a class, however, in C#, the static keyword can be applied to both methods within a normal class, and also at the class level to make the entire class static.
Shared Variables When we share a value across all instances of a class when every object of a given type should share the same variable. This is accomplished through the use of shared variables.
GDI+ in VB.NET
A transformation is a process that changes graphics objects from one state to another. Rotation, scaling, reflection, translation, and shearing are some examples of transformation. Transformation can be applied not only to graphics shapes, curves, and images, but even to image colors.
GDI+ IN VB.NET ARTICLES
No comments:
Post a Comment