I use the Lync SDK 2013 and want to extend a specific class Contact
. The contact object is able to get a displayed name by using
string displayName = contact.GetContactInformation(ContactInformationType.DisplayName);
and I want to create a new class called User
which extends this contact class. For example User
would have a property
public object DisplayName { get { return GetContactInformation(ContactInformationType.DisplayName); } }
that others just need to write
user.DisplayName
to get the displayed name of the contact. Unfortunately I have to setup a constructor when inheriting from Contact
public User() : base()
{
}
and the constructor of Contact takes some arguments. But I don't get which arguments are needed for the base constructor.
Is it possible to write "use the same constructor" without knowing the parameters?
Otherwise I don't know where to find the constructor here
#region Assembly Microsoft.Lync.Model, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
// projectPath\packages\Lync2013SDK.15.0.4466.1000\lib\net40\Microsoft.Lync.Model.dll
#endregion
using System;
using System.Collections.Generic;
using Microsoft.Lync.Model.Conversation;
using Microsoft.Lync.Model.Group;
using Microsoft.Lync.Model.Internal;
namespace Microsoft.Lync.Model
{
//
// Summary:
// Represents a contact within the Lync client. A contact can be person, bot or
// phone number.
public class Contact : UCWFull
{
//
~Contact();
//
// Summary:
// Gets the contact URI.
public string Uri { get; }
//
// Summary:
// Returns the Unified Communication type of this contact.
public UnifiedCommunicationType UnifiedCommunicationType { get; }
//
// Summary:
// Gets a collection of contact settings.
public IDictionary<ContactSetting, object> Settings { get; }
//
// Summary:
// Gets the list of all groups of which this contact is a member of.
public GroupCollection CustomGroups { get; }
//
// Summary:
// Gets the parent Contact and Group Manager of this contact.
public ContactManager ContactManager { get; }
//
// Summary:
// Occurs when one or more pieces of contact information are changed.
//
// Hints:
// Application logic must subscribe to contact information publication before the
// ContactInformationChanged event can be received. Call the CreateSubscription
// method on the ContactManager object and then add the Contact to be subscribed
// and the ContactInformationTypes that you are interested in. Finally, call the
// Subscribe method on the ContactSubscription object.
public event EventHandler<ContactInformationChangedEventArgs> ContactInformationChanged;
//
// Summary:
// Occurs when the value of a contact property changes.
public event EventHandler<ContactSettingChangedEventArgs> SettingChanged;
//
// Summary:
// Occurs when the contact URI is changed.
public event EventHandler<UriChangedEventArgs> UriChanged;
//
// Summary:
// Sets a setting associated with this contact.
public IAsyncResult BeginChangeSetting(ContactSetting contactSettingType, object contactSettingValue, AsyncCallback contactCallback, object state);
//
// Summary:
// Gets the Organization Info of this contact.
public IAsyncResult BeginGetOrganizationInformation(OrganizationStructureTypes orgInfoTypes, AsyncCallback contactCallback, object state);
//
// Summary:
// Moves this contact from a source group to a target group.
public IAsyncResult BeginMoveToGroup(Group.Group targetGroup, Group.Group sourceGroup, AsyncCallback contactCallback, object state);
//
// Summary:
// Checks if the setting can be set for this contact.
//
// Returns:
// System.Boolean
public bool CanChangeSetting(ContactSetting contactSetting);
//
// Summary:
// Checks if this contact can be moved from a source group to a target group.
//
// Returns:
// System.Boolean
public bool CanMoveToGroup(Group.Group targetGroup, Group.Group sourceGroup);
//
// Summary:
// Checks if this contact can start a given mode of communication (modality
//
// Returns:
// System.Boolean
public bool CanStart(ModalityTypes modalityTypes);
//
// Summary:
// Creates a collaboration endpoint object from a telephone number.
public ContactEndpoint CreateContactEndpoint(string telephoneUri);
//
// Summary:
// Sets a setting associated with this contact.
public void EndChangeSetting(IAsyncResult asyncResult);
//
// Summary:
// Gets the Organization Info of this contact.
public void EndGetOrganizationInformation(out ContactCollection managers, out ContactCollection peers, out ContactCollection directors, IAsyncResult asyncResult);
//
// Summary:
// Moves this contact from a source group to a target group.
public void EndMoveToGroup(IAsyncResult asyncResult);
//
// Summary:
// Gets a single contact information from this contact.
//
// Returns:
// System.Object
public object GetContactInformation(ContactInformationType contactInformationType);
//
// Summary:
// Gets contact information from this contact.
public IDictionary<ContactInformationType, object> GetContactInformation(IEnumerable<ContactInformationType> contactInformationTypes);
}
}
Instead of inheriting from the class have you considered creating an extension method
public static string DisplayName(this Contact contact)
{
return contact.GetContactInformation(ContactInformationType.DisplayName).ToString();
}