Search Results

Search found 3208 results on 129 pages for 'members'.

Page 11/129 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Why does C# allow abstract class with no abstract members?

    - by fatcat1111
    The C# spec, section 10.1.1.1, states: An abstract class is permitted (but not required) to contain abstract members. This allows me to create classes like this: public abstract class A { public void Main() { // it's full of logic! } } This is really a concrete class; it's only abstract in so far as one can't instantiate it. If inheritors don't actually have to provide implementation, then why call it abstract?

    Read the article

  • what if i keep my class members are public?

    - by anish
    In c++ instance variables are private by default,in Python variables are public by default i have two questions regarding the same:- 1: why Python have all the members are public by default? 2: People say you should your member data should be private what if i make my data to be public? what are the disadvantages of this approch? why it is a bad design?

    Read the article

  • Is there a C# equivalent of typeof for properties/methods/members?

    - by David
    A classes Type metadata can be obtained in several ways. Two of them are: var typeInfo = Type.GetType("MyClass") and var typeInfo = typeof(MyClass) The advantage of the second way is that typos will be caught by the compiler, and the IDE can understand what I'm talking about (allowing features like refactoring to work without silently breaking the code) Does there exist an equivalent way of strongly referencing members/properties/methods for metadata and reflection? Can I replace: var propertyInfo = typeof(MyClass).GetProperty("MyProperty") with something like: var propertyInfo = property(MyClass.MyProperty)

    Read the article

  • How do I update the members of a MySQL SET Type?

    - by MachinationX
    I have a table of values, with one of the columns being of type SET. If it currently has the members ('a', 'b', 'c', 'd'), how do I add 'e' to the possible values? I realize that using a SET type is a little strange, and I'm unclear why one would use it instead of a foreign key to another table with the values of the set, but I didn't design the database in question, and can't change it that much. Thanks for your help!

    Read the article

  • In ActionScript3 runtime, is there a way to get a list of all static members from a Class

    - by ty
    Let's say we have following class public class PlayerEvent extends Event { public static const PLAYER_INIT:String = "playerInit"; public static const PLAYER_MOVE:String = "playerMove"; public static const PLAYER_USE_SKILL:String = "playerUseSkill"; public function PlayerEvent(type:String) { super(type, false, true); } } } In Flash Player runtime, is there a way I can get a list of all the static members of lass PlayerEvent. Something like: trace(PlayerEvent.staticMethods) // ["PLAYER_INIT", "PLAYER_MOVE", "PLAYER_USE_SKILL"]...

    Read the article

  • Entity Framework many-to-many using VB.Net Lambda

    - by bgs264
    Hello, I'm a newbie to StackOverflow so please be kind ;) I'm using Entity Framework in Visual Studio 2010 Beta 2 (.NET framework 4.0 Beta 2). I have created an entity framework .edmx model from my database and I have a handful of many-to-many relationships. A trivial example of my database schema is Roles (ID, Name, Active) Members (ID, DateOfBirth, DateCreated) RoleMembership(RoleID, MemberID) I am now writing the custom role provider (Inheriting System.Configuration.Provider.RoleProvider) and have come to write the implementation of IsUserInRole(username, roleName). The LINQ-to-Entity queries which I wrote, when SQL-Profiled, all produced CROSS JOIN statements when what I want is for them to INNER JOIN. Dim query = From m In dc.Members From r In dc.Roles Where m.ID = 100 And r.Name = "Member" Select m My problem is almost exactly described here: http://stackoverflow.com/questions/553918/entity-framework-and-many-to-many-queries-unusable I'm sure that the solution presented there works well, but whilst I studied Java at uni and I can mostly understand C# I cannot understand this Lambda syntax provided and I need to get a similar example in VB. I've looked around the web for the best part of half a day but I'm not closer to my answer. So please can somebody advise how, in VB, I can construct a LINQ statement which would do this equivalent in SQL: SELECT rm.RoleID FROM RoleMembership rm INNER JOIN Roles r ON r.ID = rm.RoleID INNER JOIN Members m ON m.ID = rm.MemberID WHERE r.Name = 'Member' AND m.ID = 101 I would use this query to see if Member 101 is in Role 3. (I appreciate I probably don't need the join to the Members table in SQL but I imagine in LINQ I'd need to bring in the Member object?) UPDATE: I'm a bit closer by using multiple methods: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim count As Integer Using dc As New CBLModel.CBLEntities Dim persons = dc.Members.Where(AddressOf myTest) count = persons.Count End Using System.Diagnostics.Debugger.Break() End Sub Function myTest(ByVal m As Member) As Boolean Return m.ID = "100" AndAlso m.Roles.Select(AddressOf myRoleTest).Count > 0 End Function Function myRoleTest(ByVal r As Role) As Boolean Return r.Name = "Member" End Function SQL Profiler shows this: SQL:BatchStarting SELECT [Extent1].[ID] AS [ID], ... (all columns from Members snipped for brevity) ... FROM [dbo].[Members] AS [Extent1] RPC:Completed exec sp_executesql N'SELECT [Extent2].[ID] AS [ID], [Extent2].[Name] AS [Name], [Extent2].[Active] AS [Active] FROM [dbo].[RoleMembership] AS [Extent1] INNER JOIN [dbo].[Roles] AS [Extent2] ON [Extent1].[RoleID] = [Extent2].[ID] WHERE [Extent1].[MemberID] = @EntityKeyValue1',N'@EntityKeyValue1 int',@EntityKeyValue1=100 SQL:BatchCompleted SELECT [Extent1].[ID] AS [ID], ... (all columns from Members snipped for brevity) ... FROM [dbo].[Members] AS [Extent1] I'm not certain why it is using sp_execsql for the inner join statement and why it's still running a select to select ALL members though. Thanks. UPDATE 2 I've written it by turning the above "multiple methods" into lambda expressions then all into one query, like this: Dim allIDs As String = String.Empty Using dc As New CBLModel.CBLEntities For Each retM In dc.Members.Where(Function(m As Member) m.ID = 100 AndAlso m.Roles.Select(Function(r As Role) r.Name = "Doctor").Count > 0) allIDs &= retM.ID.ToString & ";" Next End Using But it doesn't seem to work: "Doctor" is not a role that exists, I just put it in there for testing purposes, yet "allIDs" still gets set to "100;" The SQL in SQL Profiler this time looks like this: SELECT [Project1].* FROM ( SELECT [Extent1].*, (SELECT COUNT(1) AS [A1] FROM [dbo].[RoleMembership] AS [Extent2] WHERE [Extent1].[ID] = [Extent2].[MemberID]) AS [C1] FROM [dbo].[Members] AS [Extent1] ) AS [Project1] WHERE (100 = [Project1].[ID]) AND ([Project1].[C1] > 0) For brevity I turned the list of all the columns from the Members table into * As you can see it's just ignoring the "Role" query... :/

    Read the article

  • How to mock protected virtual members with Rhino.Mocks?

    - by Vadim
    Moq allows developers to mock protected members. I was looking for the same functionality in Rhino.Mocks but fail to find it. Here's an example from Moq Quick Start page how to mock protected method. // at the top of the test fixture using Moq.Protected() // in the test var mock = new Mock<CommandBase>(); mock.Protected() .Setup<int>("Execute") .Returns(5); // if you need argument matching, you MUST use ItExpr rather than It // planning on improving this for vNext mock.Protected() .Setup<string>("Execute", ItExpr.IsAny<string>()) .Returns(true); Let me know if I'm chasing something that doesn't exit.

    Read the article

  • How to instanciate a class when its property members are not of primitive types?

    - by Richard77
    Hello, 1) Let's say I've a class MyDataInfo public class MyDataInfo { public int MyDataInfoID { get; set; } public string Name { get; set; } } For the purpose of the fuctionality I'm after, I've created another class (MyData) whose property members are of MyDataInfo type. 2) Here's myData public class MyData { public MyDataInfo Prop1 { get; set; } public MyDataInfo Prop2 { get; set; } } 3) And, here's my action method public ActionResult MyAction() { MyData myObject = new MyData(); return View(myObject); } 4) Finally, this in my View template (which is strongly typed and inherits from MyData) <% = Html.Encode (Model.Prop1.Name)%> <% = Html.Encode (Model.Prop2.Name)%> Unfortunately, I got an error "Object not set to an instance of an object." Am I missing something or is there a different way of obtaining the same result? Thanks for helping

    Read the article

  • How do I make the Drupal-Core Forum display only to members, and ask for login details otherwise

    - by Busk
    I'm trying to create a website, that has a menu based on Primary Links on the top of the site. The one menu item is for a 'Members Forum'. I want this menu item visible to all users (Anonymous/Authorized), but if an Anonymous user clicks on the item, instead of displaying "Access Denied", I'd prefer to show a custom message "such as please login to access the forum". If an Authorized user clicks it, obviously I want them to go straight to the page. In the Forum module, I've set up a container for the forum that is only viewable for Authorized users, so that when an Anonymous user clicks the menu item, they get the Access Denied error. Thank you

    Read the article

  • How do I reference members of a single object passed to the View?

    - by Juxtaposed
    I'm new to MVC2 in ASP.NET/C#, so please forgive me if I misunderstand something. I have code similar to this in my Controller: var singleInstance = new Person("John"); ViewData["myInstance"] = singleInstance; return View(); So in my view, Index.aspx, I want to be able to reference members in that object. For example, Person has a member called Name, which is set in the constructor. In the view I want to get Person.Name from what is stored in the ViewData object. Ex.: <%= ViewData["myInstance"].name %> That doesn't work. The only real workaround I've found is to do something like this: <% var thePerson = ViewData["myInstance"]; print (or whatever the method is) thePerson.Name; %> Any help would be much appreciated... This was so much easier in PHP/Zend Framework... sigh

    Read the article

  • Sprint to the finish: how to keep all team-members busy in the final days of a Scrum sprint?

    - by sdg
    Given that the tasks in a specific sprint will not divide perfectly into the team, and all finish on the same date, what do you do to keep everyone working as the sprint moves into its final stages? Inevitably it seems like there will be one or two people freed-up. If all the other tasks are done-done, and the remaining tasks are already underway, then what? Do those team-members pick up items from the top of the product backlog, as they are likely to be needed in the next sprint anyways to get a head start? What do you or your teams do?

    Read the article

  • Use this. to access internal class members?

    - by Sam
    On the internet I see a lot of code which uses this. to access local members of a class, like this: private String _whatever; public String Whatever { get { return this._whatever; } set { this._whatever = value; } } public void DoSomething() { String s = this.Whatever; this.DoSomething(); } (don't expect the code to do something sensible. I just wanted to show a few different uses for "this.") I wonder why to do this? To add more clarity to the source? Or is it just a waste of space?

    Read the article

  • Private vs. Public members in practice (how important is encapsulation?)

    - by Asmor
    One of the biggest advantages of object-oriented programming is encapsulation, and one of the "truths" we've (or, at least, I've) been taught is that members should always be made private and made available via accessor and mutator methods, thus ensuring the ability to verify and validate the changes. I'm curious, though, how important this really is in practice. In particular, if you've got a more complicated member (such as a collection), it can be very tempting to just make it public rather than make a bunch of methods to get the collection's keys, add/remove items from the collection, etc. Do you follow the rule in general? Does your answer change depending on whether it's code written for yourself vs. to be used by others? Are there more subtle reasons I'm missing for this obfuscation?

    Read the article

  • Can I get a domain controller not to act as DNS for the members?

    - by rsw
    Hi, Let me try to explain my current setup. I have one linux machine acting as DHCP and DNS (dhcpd3 and bind) in my network. This works fine, all computers I hook up to the network gets an IP address and proper DNS servers set. Let's call it 10.12.0.10 However, we also have a Windows Server 2003 Domain Controller in our network to which we add our Windows computers (running XP), let's call it 10.12.0.20. I noticed that when I run 'nslookup' on one of the windows machines, it says that the primary DNS is 10.12.0.20. This have not been much of a problem since: The Windows clients are stationary The Windows server in itself point out my real DHCP/DNS, since I can reach everything specified in it However, this turns out to be a problem when we use Laptops. They connect to the domain here and gets a DNS server, but when the user travels or connect the computer from home, we hit a problem. They are connected to their internet, but their DNS is 10.12.0.20 which they can't reach since they're at home and not at the office network. I solved this by removing the register key called "NameServer" with the value 10.12.0.20, but it gets set again whenever they logon to the domain the next time (when they get back to the office). Can I somehow make the computers take whatever DNS server they are handed when connecting to the internet or a home network, instead of always trying to reach the Domain Controller?

    Read the article

  • Is it possible to restrict fileserver access to domain users using computers that are members of the domain?

    - by Chris Madden
    It seems domain isolation can be used to accomplish, but I'd like a solution that doesn't require IPsec, or more accurately, doesn't require IPsec on the fileserver. IPsec if done in software has a large CPU overhead and our NAS boxes don't support any kind of offload. The goal is to avoid authenticated users using non-managed machines to access network resources. Network Access Protection (NAP) and the various enforcement points looked promsiing but I couldn't find a bulletproof way to use them [which doesn't require IPsec on the fileserver]. I was thinking when a domain user accesses the NAS box it will first need a Kerberos ticket from AD, so if AD could somehow verify the computer that was requesting the ticket was in the domain I'd have a solution.

    Read the article

  • I want Lotus Domino to only send one email to users that are both recipients and members of a cc'ed lotus group.

    - by Marcus
    Lotus Domino 7 and now Lotus Domino 8.5 The scenario: A@mycompany writes an email to b@internet and cc's it to group@mycompany. A@mycompany is a member of group@mycompany. With the initial email Domino is intelligent enough to not send the email which a@mycompany just wrote to a@mycompany again. But when b@internet answers to all (a@mycompany + group@mycompany) then a@mycompany gets this email twice, because he is not only the author but also a member of group@mycompany. During the smtp session the email is sent once with the recipients set to a@mycompany and group@mycompany and a single esmtp id. So Domino should well be able to see that the mail should only be sent to a@mycompany once. Can I make Lotus Domino behave in this sane fashion?

    Read the article

  • In .NET, Why Can I Access Private Members of a Class Instance within the Class?

    - by AMissico
    While cleaning some code today written by someone else, I changed the access modifier from Public to Private on a class variable/member/field. I expected a long list of compiler errors that I use to "refactor/rework/review" the code that used this variable. Imagine my surprise when I didn't get any errors. After reviewing, it turns out that another instance of the Class can access the private members of another instance declared within the Class. Totally unexcepted. Is this normal? I been coding in .NET since the beginning and never ran into this issue, nor read about it. I may have stumbled onto it before, but only "vaguely noticed" and move on. Can anyone explain this behavoir to me? I would like to know the "why" I can do this. Please explain, don't just tell me the rule. Am I doing something wrong? I found this behavior in both C# and VB.NET. The code seems to take advantage of the ability to access private variables. Sincerely, Totally Confused Class Jack Private _int As Integer End Class Class Foo Public Property Value() As Integer Get Return _int End Get Set(ByVal value As Integer) _int = value * 2 End Set End Property Private _int As Integer Private _foo As Foo Private _jack As Jack Private _fred As Fred Public Sub SetPrivate() _foo = New Foo _foo.Value = 4 'what you would expect to do because _int is private _foo._int = 3 'TOTALLY UNEXPECTED _jack = New Jack '_jack._int = 3 'expected compile error _fred = New Fred '_fred._int = 3 'expected compile error End Sub Private Class Fred Private _int As Integer End Class End Class

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >