i tried to create a dll using c# and now i have something like this

I have 5 files Extension.cs, Encryption.cs, MySQLQuery.cs, etc.

and in my MySQLQuery file i have somthing like this

using System;
using System.Data;
using System.Text;
using MySql.Data.MySqlClient;

namespace gLibrary
{
    public class MySQLQuery
    {
        protected internal static string connectionString;
         public class ConnectionString
        {
            public string temp { get; set; }

            public static void Default(string ConnectionString)
            {
                connectionString = ConnectionString;
            }

            public static void dispose()
            {
                connectionString = null;
            }
        }
        public class ExequteQuery
        {
            //Some code here...
        }

        //and so on...
    }
}

now i import it then i try to access like this

using gLibrary.MySQLQuery;

but i got an error

but when i tried something like this

using gLibrary;

and accessing like this

MySQLQuery.somefuntion();

it works perfectly but what i want to accomplish is to have something like this

Using gLibrary.MySQLQuery;

namespace something
{
    class something
    {
        //then i want to access it like this
        somefunction();
    }
}

i hope someone can help me with this, actually i already done it with vb.net but i cant implement to c#

i will appreciate for any help

C# doesn't work this way. using is only intended to have the compiler imply the namespace of a class. IMO, this would make your code difficult to read, as another programmer would have to search for the particular class the method is defined in.

so what you suggest for this thank you

but is there a way to accomplish the code like this

using gLibrary.MySQLQuery;

Not that I am aware of. Like I said, using only works with namespaces (also aliases of namespaces and classes, but still not what you want). Maybe do a search for extensions for your IDE that do this (or make your own).

i am sorry but i think there is a misunderstanding here, there is nothing to do with my IDE if i am right. Actually i already done it but i used VB.net

here is some code of it

Imports DevExpress.XtraEditors
Imports System.Windows.Forms
Imports System.Speech.Synthesis
Imports MySql.Data.MySqlClient
Imports RandomText
Public Class Extensions

    Shared Sub Messenger(ByVal msg As String, ByVal title As String, ByVal type As Integer)
            If type = 1 Then
                XtraMessageBox.Show(msg, title, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
            Else
                XtraMessageBox.Show(msg, title, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
            End If
    End Sub

     Shared Function SqlQuerySproc(ByVal Connection As String, ByVal Sproc As String, ByVal Param As String) As Boolean
        Const splt1 = "*", splt2 As String = "|"
        Dim spltd1() As String = Param.Split(splt1)
        Dim spltd2() As String
       //some code...
    End Function

        Shared Function MysqlDataRowsCounter(ByVal ConnectionString As String, ByVal Command As String) As Integer
        Return DataTableFiller(Command, ConnectionString).Rows.Count
    End Function
    End Class

then i try to import the dll into the new project

then i can access it like this

Imports extcls.Extensions
Imports extcls.Library
Public Class newLoan
    Dim total, interest, daily As Decimal

     Private Sub loan(ByVal update1 As Integer)
        Dim value As String = String.Format("_id|34|{0}*_client|34|{1}*_collector|34|{2}*_control|34|{3}*_collateral|34|{4}*_released|4|{5}*_dueDate|4|{6}*_amount|6|{7}" & _
                                            "*_interest|6|{8}*_payable|6|{9}*_daily|6|{10}*_days|13|{11}*_update|13|{12}",
                                            code(),
                                            combo_client.Text,
                                            combo_assiignedTo.Text,
                                            txt_controlNo.Text,
                                            txt_collateral.Text,
                                            date_released.Text,
                                            txt_dueDate.Text,
                                            txt_amount.Text,
                                            interest,
                                            total,
                                            daily,
                                            fnc_noOfDays(combo_noOfDays.SelectedIndex),
                                            update1)

        Try
            If SqlQuerySproc(_connectString, "sproc_loan", value) Then
                Messenger("Successfully Loaned", "Loan", 1)
                GC_loans.DataSource = DataTableFiller("SELECT * FROM vw_loanbalance ORDER BY vw_loanbalance.`Balance` DESC", _connectString)
            Else
                Messenger("Failed to save new Data", "Loan", 0)
            End If
        Catch ex As MySql.Data.MySqlClient.MySqlException
            If ex.Number = 1062 Then
                Messenger("A Duplicate entry of Control No. haas been detected please its value.", "ERROR", 0)

            ElseIf ex.Number = 1048 Then
                Messenger("Dont leave blank fields", "ERROR", 0)
            Else
                Messenger("There is an error occurred while you are saving the data, please correct it or close the program and open it again.", "UNHANDLED EXCEPTION", 0)
            End If
        Catch
            Messenger("Please dont leave required Page blank or invalid format of date", "Error", 0)
        End Try
    End Sub

End Class

Something like that, but what iwant is to accomplish it using c#

I hope can you help me thanks

C# doesn't work that way. 'using' imports namespaces so that you don't have to type the full class name to get access to the class. All methods belong to a class and you either reference them through the class (static methods) or an instance of the class (non-static methods).

so there is no chance to achive the code like this

using extcls.Extensions;
using extcls.Library;

if i create a dll file using C#?

There's no misunderstanding; you can't do it with the standard C# specification. There's a possibility that someone out there wrote an extension or tool to do this...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.