Inline Documentation For A Interface Implementation?
Jul 14, 2010
Is there any way to include some kind of auto-generated comments as part of implementing an interface? Studio automatically fills the headers for the methods, can I auto-fill some sort of code comments at that same time? (to help remember what each interface method is supposed to do without looking at external documentation.) For example, if I could get the interface's XML Intellisense markup headers to copy from the interface down to the implementation's level.
View 3 Replies
ADVERTISEMENT
Dec 11, 2009
I'm starting a new project; trying to be more strict than previous ones. I've set warnings as errors in the build I've added FxCop to PostBuild. The one last thing on my list os require people to add inline docs for all classes/non-private methods/properties.
View 2 Replies
Jan 19, 2011
I need to implement the IBindableComponent to the the following code:
Public Class InfragisticsToolStripBindableButton
Inherits Infragistics.Win.UltraWinToolbars.ButtonTool
Implements IBindableComponent
[CODE]...
1 problem: Warning: event 'Disposed' conflicts with property 'Disposed' in the base class 'DisposableObject' and should be declared 'Shadows'
2 problem: Error: Class 'InfragisticsToolStripBindableButton' must implement 'Property Site As ISite' for interface 'System.ComponentModel.IComponent'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.
Why should I implement "IComponent" if I implement "IBindableComponent"?
3 problem: How should I override "Dispose", if it's already implemented in the base class, but is not virtual apparently.
View 1 Replies
Feb 8, 2011
I need to implement the IBindableComponent to the the following code:
Public Class InfragisticsToolStripBindableButton
Inherits Infragistics.Win.UltraWinToolbars.ButtonTool
Implements IBindableComponent
[code].....
View 2 Replies
May 21, 2010
What is the diference of using interfaces like ...I have an interface
Public Interface IProDataSource
Function read() As Integer
End Interface[co]....de
The only difference I have notice is that if the method is declare private it will be visible using the first approach only.
View 3 Replies
Dec 25, 2009
I have been reading about design patterns and application architecture and im told that I should program to an interface instead of implementation. This i understand. So I figured I would start with something small. Never programmed with an interface before. So I want to create an encryption program that will allow the user to select which method to encrypt it with, AES, DPAPI, etc. I started designing the Interface but I am unsure if I am doing this right. [Code] Also, when it comes to the DPAPI implementation, how is the client supposed to supply the Protection Scope? I didn't think this should be in the interface as it only applys to the DPAPI.
View 1 Replies
Sep 11, 2010
This may seem like an obvious answer, but I can't seem to find an answer. I have this code in VB.NET[code]...
The problem with this is that in C#, it would seem you have to name the function the same as the interface function you are implementing. How can I call this method EncryptionVB instead of Encryption, but still implement the Encryption property?
View 5 Replies
Oct 16, 2009
How to implement explicit interface implementation in VB.NET?
View 3 Replies
Jul 16, 2009
I am reading a book (ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution, WROX)The source code is written in C#, but I am a VB guy, so I am giving it a try. Somewhere in the 2nd chapter, there is a Linq to Sql file used that is generated by drag&dropping the DB tables from the Database Explorer. Because some tables have the same type of fields, there is an interface generated called IENTBaseEntity. The writer says its a good practice to implement this interface in another partial class (not the designer.vb file!). The reason for this is that when the LinqToSql file is modified (and regenerated) the changes wont be lost.
In C# this solution is easy to do (i think), but in VB.Net I get an error, because the concerning properties in the LinqToSql file do not append the 'Implement IENTBaseEntity.Property' line. When I press [Enter] after the interface implementation line, VS generates other properties like this
Partial Public Class ENTUserAccount
Implements IENTBaseEntity '--->This line results in the error
' This is not the way it should be
Public Property InsertDate1() As Date Implements IENTBaseEntity.InsertDate
Get
End Get
[code]....
View 5 Replies
Oct 27, 2009
Private Sub ActivateMe(ByVal active As Boolean) Implements IGraphicControl .ActivateMe compiles.How is possible in VB.NET? A private method can be an interface implementation. VB.NET... a lot of compliments to this language and IDE..
View 6 Replies
Jan 9, 2010
I have a C# interface defined as so:
public interface IMenuSecurityService
{
void SetSecurityFlags(List<MenuItem> items);
}
I need to implement this interface in a VB.Net class. When I implement the SetSecurityFlags method with the items parameter passed ByVal, it compiles.
Public Sub SetSecurityFlags(ByVal items As List(Of L1.Common.Model.MenuItem)) Implements IMenuSecurityService.SetSecurityFlags
' do some work
End Sub
When I try to implement it with the items parameter passed ByRef, I get the following compiler error: Class 'UserRights' must implement 'Sub SetSecurityFlags(items As System.Collections.Generic.List(Of Model.MenuItem))' for interface
Public Sub SetSecurityFlags(ByRef items As List(Of L1.Common.Model.MenuItem)) Implements IMenuSecurityService.SetSecurityFlags
' do some work
End Sub
I can't seem to figure this one out. Does VB.Net not support this or am I doing something wrong?
View 1 Replies
Jan 11, 2011
In Visual Studio, when you right-click a method call, you go to the implementation of that method inside a class except if you access this method through an interface: in that case you go to the interface method not to the actual implementation.Is there a way / tips (key shortcut or anything) to access this actual implementation ? Otherwise you are stuck to add some comment just to remember where you did implement it that's really not productive and error prone !
Update: interesting answers but I'm not really satisfied because all are cumbersome. I will give a precise example:
IInterface iInterface = someObject;
iInterface.someMethod();
View 6 Replies
Jul 5, 2010
In the code below, when I use the same interface with O in the Class declaration line and the Inherits line, I then get a compiler error when I access the interfaces Year member in both the properties. It says " 'Year' is not a member of 'IRegionYear'." I get the same thing if I use the same class with each Of.
I don't get this error when the interface or class entered for both Of clauses are different.
Interface IRegionYear
ReadOnly Property Year() As Integer
End Interface
MustInherit Class RegionYears(Of IRegionYear)
[Code] ......
View 4 Replies
Sep 12, 2009
I have a public interface. i have class that implements the interface, how do i make the implementation of interface members internal or private in the implementation class? If i declare an interface internal, how to implement that in an public class?
View 2 Replies
Feb 28, 2011
I am creating an xlsx reader / writer for my application (based on OpenXML SDK 2.0). I want to read xlsx files and store the data contained in each row in a DTO/PONO. Further I want to read the xlsx file and then modify it and save it.Now my problem is not with the OpenXML SDK, I can do what I need to do.My problem is on how to structure my components. Specifically I have problems with the polymorphism at the lowest level of a Spreadsheet, the cell.A cell in Excel/OpenXML can have different types of data associated with it. Like a Time, Date, Number, Text or Formula. These different type need to be handled differently when read/written from/to a spreadsheet.I decided to have a common interface for all subtypes like TextCell, NumberCell, DateCell etc.Now when I read the cell from the spreadsheet the Method/Factory can decide which type of cell to create.
Now because the cell is an abstract from the real implementation it does not know / does not need to know of what type it is. For writing / modifying the cell I solve this problem by calling .write(ICellWriter) on the cell I want to persist. As the cell itself knows what type of data it contains, it knows which method of ICellWriter it needs to call (static polymorpism).Writing to the xlsx file is no problem. My problem is, how do I get the data out of my cell into my DTO/PONO without resorting to type checking -> If TypeOf variable is ClassX then doesomething End If. As Methods / Properties have to have different Signatures and differentiating by only using a different return type is not allowed.The holder (collection, in this case a row of a table/spreadsheet) of the objects (refering to the cells) does not know the concrete implementations. So for writing a cell I pass it a Cellwriter. This Cellwriter has overloaded methods like Write(num as Integer), Write(text as String), Write(datum as Date). The cell object that gets this passed to it then calls the Write() method with the data type it holds. This works, as no return value is passed back.After some thinking about the problem I came to realize that it's not possible without reflection or knowledge of what type of cell I am expecting. Basically I was trying to recreate a spreadsheet or something with similar functionality and way too abstract/configurable for my needs.
View 1 Replies
Apr 20, 2009
I am comparing an alternative Dispose pattern to VS2005's default implementation. In doing the comparison I have found several uncertainties with the default pattern which have raised a handful of questions related to sub-class implementations and object Finalization.
[Code]...
View 1 Replies
Mar 18, 2010
So I've been doing some research on the singleton factory design pattern, and I am wondering if my example implementation is correct (warning I did get carried away creating animals):
[Code]...
View 6 Replies
Nov 4, 2009
i have an VB.NET application with few functions i need to debug (like ie. Assert in C#). Is it possible and how i do that ?
Public Shared Function createNumberArrayList(ByVal startValue As Integer, _
ByVal endValue As Integer, _
Optional ByVal isBackwards As Boolean = False) As ArrayList
[Code].....
Basically what i need is to enter few values and see if the function works and returns proper ArrayList.
View 1 Replies
May 6, 2012
strtest() = objFile.ReadToEnd.Trim.Replace(vbCr, "").Split(vbLf).Distinct.ToArray
I created this command from a few examples which reads the text from a StreamReader, Trims, splits on EoL, and returns a unique list. My next command is a sort. I couldnt figure out how to add a sort to this command. Its really not that important but I was curious if there�s an easy way.
Additionally if there's a better way to take a text file into an array or collection I'm all ears.
View 10 Replies
Jun 22, 2010
Tell vb.net equivalent of following method:
CODE:
Which on build in visual studio 2005 gives an error.
View 2 Replies
Sep 16, 2010
I need a inline calculator for a textbox.
When the user types 45*10+5 i need to have the answer displayed as 455 in the same textbox
Any one with a briljant idea of how to sovle this.
View 9 Replies
Feb 11, 2009
I know that this should probably be under mobile development .. but no one seems to use that thread ... so anyway .. here is what i am trying to do:
TreeView1.LabelEdit = True
With TreeView1.Nodes.Add("asd")
.BeginEdit()
End With
The above works for a windows application ... but i was wondering how i could do this on a windows mobile application as LabelEdit and BeginEdit don't exist!
View 1 Replies
Jan 27, 2012
This is my problem. If I write this -
[Code]...
But I'm just out of my wit why this code, written to do the same thing is not working -
[Code]...
View 1 Replies
Aug 13, 2010
I am trying to do an inline IF statement inside a asp:Repeater control to add a class to the first item, but I can't quite seem to figure it out. Basically the code I have right now that is not working but should give an idea of what I'm "trying" to do looks like this.
<asp:Repeater ID="rptrTabRepeater" runat="server">
<ItemTemplate>
<div class="tab <%= If Container.ItemIndex = 0 Then %>highlight<% End If%>">
'Other stuff here
[code]....
I have tried using the OnItemDataBound event but the delegate interface cannot return a value. If I'm going to do anything from a code-behind function really it would just need to be an "echo" kind of function which I wasn't quite sure how to get the item index in a code behind function.
EDIT: The compile error I am getting is:
Compiler Error Message: BC30201: Expression expected.
View 2 Replies
Nov 20, 2009
I have an element that I'm trying to style:
<tr runat="server" id="row" >
...
</tr>
And I set the style programmatically:
row.Attributes("style") = "background: #cccccc;"
I get this output:
<tr id="SearchResults_myRepeaterPlain_ctl04_row" style="background: rgb(204, 204, 204) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">
Where is all that additional style information coming from, and How can I stop it?
View 1 Replies
Jul 9, 2009
Just out of curosity, what's wrong with the following line. I'm trying to create a range of integers (3,4,5...,50) and then filtering out only those numbers which are not divisible by any integer less than themselves (bruteforce way of finding primes).
Enumerable.Range(3, 50).Where(Function(x) Not Enumerable.Range(2, x - 1).Any(Function(y) x Mod y = 0))
View 1 Replies
Oct 4, 2010
I would like to know if there's any way to specify an inline array (lets say of strings) to custom attribute on a property in vb.net.
I have the following example that doesn't compile in vb.net (.net 1.1):
Attributes.ManyToOne(New String() {"a", "b", "c"})> _
Public Property PaymentTerms() As PaymentTerms
[Code]....
I get compiler error when I feed the array to the custom attribute in vb.net. I have no problem in C#, just vb.net. What is the correct syntax in this silly language?
View 1 Replies
May 27, 2010
tell vb.net equivalent of following method:
C# Syntax
public class RecentPosts : Control
{
[code].....
View 3 Replies
Aug 10, 2010
Suppose we have a class like:
Public Class Question
Private Shared _field as Integer = CrazyIntegersRepository.GetOne()
' Some other useful things go here
End Class
And the method GetOne throws an exception... How can we manage that? Is a good practice to rewrite that into a static constructor? When is the GetOne method going to be executed if we leave it there in the inline _field declaration?
View 3 Replies
Feb 27, 2011
Check out this code sample from Scott Guthrie's blog: [URL]...Notice item is a reference to the currently executing item in C#, what is the equivalent keyword in VB.NET?
EDIT: I should add here is my actual implementation of a method accepting a template:
Public Function RenderInlineTemplate(ByVal template As Func(Of RazorSamplesWeb.Models.SamplesModel, Object)) As IHtmlString Return New HtmlString("<div style='display:inline;'>" + template(Model) + "</div>")
End Function And I get this error: Compiler Error Message: BC30201: Expression expected.
[Code]...
View 2 Replies